*/
void testTraversalInconsistency() {
Form form = new Form("Test Form 2");
FormLFImpl formLF = (FormLFImpl)form.formLF;
final Baton baton = new Baton();
SerialCallback scb = new SerialCallback(dpy);
// can be any interactive item
Item item = new Gauge(null, true, 1, 0);
// Set up a form with no focusable item.
form.append("String 1");
dpy.setCurrent(form);
scb.invokeAndWait();
// Block the event queue to prevent the invalidate from
// being processed.
dpy.callSerially(
new Runnable() {
public void run() {
baton.pass();
}
});
baton.start();
// Append a focusable item to the form, and then call
// uTraverse() directly, as if a key had been pressed at
// exactly the right moment.
form.insert(0, item);
formLF.uTraverse(Canvas.DOWN);
baton.finish();
// Wait for the invalidate to finish processing, then
// check assertions.
scb.invokeAndWait();
assertEquals("item 0 should be focused", 0, formLF.traverseIndex);
}