public void test(TestHarness harness)
{
MyTestList l = new MyTestList(new String[]{"item"});
TestList.AccessibleTestList al =
(TestList.AccessibleTestList) l.getAccessibleContext();
AccessibleComponent child = (AccessibleComponent) al.getAccessibleChild(0);
l.visible = true;
harness.check(child.isVisible(), true);
l.visible = false;
harness.check(child.isVisible(), true);
harness.check(l.isVisible(), false);
// The above test show that isVisible is independent from the parent JList.
// Check if this reacts to child.setVisible() (It does not).
child.setVisible(true);
harness.check(child.isVisible(), true);
child.setVisible(false);
harness.check(child.isVisible(), true);
// The only thing left is that isVisible depends on the values
// of JList.getFirstVisibleIndex and JList.getLastVisibleIndex
AccessibleContext ctx = (AccessibleContext) child;
AccessibleStateSet states;
l.first = 0;
l.last = 0;
harness.check(child.isVisible(), true);
states = ctx.getAccessibleStateSet();
harness.check(states.contains(AccessibleState.VISIBLE));
l.first = 1;
l.last = 1;
harness.check(child.isVisible(), false);
states = ctx.getAccessibleStateSet();
harness.check(!states.contains(AccessibleState.VISIBLE));
}