* race condition between modifying a Form's contents (for example, with
* append) while the Form is in the process of becoming current.
*/
void testScreenChangeAppend() {
StringItem items[] = new StringItem[10];
final Baton baton = new Baton();
for (int ii = 0; ii < items.length; ii++) {
items[ii] = new StringItem(null, Integer.toString(ii % 10));
}
Form form = new Form("Test Form");
// gets called from dpy.callScreenChange() after uCallShow()
dpy.liveTracer.add(
Display.LTR_SCREENCHANGE_AFTERSHOW,
new LiveTraceListener() {
public void call(String tag) {
baton.pass();
}
});
dpy.setCurrent(form);
for (int ii = 0; ii < items.length; ii++) {
form.append(items[ii]);
if (ii == 3) {
baton.start();
}
}
baton.finish();
// wait for queued events to be processed
new SerialCallback(dpy).invokeAndWait();
assertTrue("layout must be valid", checkValidLayout(form));