public class getAccessibleContext
implements Testlet
{
public void test(TestHarness harness)
{
JToolTip tt = new JToolTip();
AccessibleContext att = tt.getAccessibleContext();
// check the default values
harness.check(att.getAccessibleName(), null);
harness.check(att.getAccessibleDescription(), null);
harness.check(att.getAccessibleComponent(), att);
harness.check(att.getAccessibleRole(), AccessibleRole.TOOL_TIP);
// setting the tip text on the tool tip updates the accessible description
tt.setTipText("XYZ");
harness.check(att.getAccessibleDescription(), "XYZ");
tt.setTipText(null);
harness.check(att.getAccessibleDescription(), null);
// setting the accessible description doesn't update the tip text
att.setAccessibleDescription("ABC");
harness.check(att.getAccessibleDescription(), "ABC");
harness.check(tt.getTipText(), null);
// ...and once an explicit description is set, it isn't changed by setting
// the tip text
tt.setTipText("DEF");
harness.check(att.getAccessibleDescription(), "ABC");
// TODO: the following should fire a property change event
att.setAccessibleName("X");
harness.check(att.getAccessibleName(), "X");
// does getAccessibleContext() always return the same instance?
AccessibleContext att2 = tt.getAccessibleContext();
harness.check(att == att2);
}