events.add(e);
}
public void test(TestHarness harness)
{
AbstractButton b = new JButton("ABC");
b.addPropertyChangeListener(this);
b.setVerticalTextPosition(SwingConstants.TOP);
harness.check(b.getVerticalTextPosition(), SwingConstants.TOP);
PropertyChangeEvent e = (PropertyChangeEvent) events.get(0);
harness.check(e.getSource(), b);
harness.check(e.getPropertyName(), "verticalTextPosition");
harness.check(e.getOldValue(), new Integer(SwingConstants.CENTER));
harness.check(e.getNewValue(), new Integer(SwingConstants.TOP));
// setting the same value should generate no event
events.clear();
b.setVerticalTextPosition(SwingConstants.TOP);
harness.check(events.size(), 0);
// try an illegal argument
boolean pass = false;
try
{
b.setVerticalTextPosition(SwingConstants.LEFT);
}
catch (IllegalArgumentException ex)
{
pass = true;
}