public void test(TestHarness harness)
{
Icon icon1 = MetalIconFactory.getFileChooserNewFolderIcon();
Icon icon2 = MetalIconFactory.getHorizontalSliderThumbIcon();
AbstractButton b = new JButton("123");
b.setRolloverEnabled(false);
b.addPropertyChangeListener(this);
b.setRolloverSelectedIcon(icon1);
harness.check(b.getRolloverSelectedIcon(), icon1);
harness.check(events.size(), 2);
PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
harness.check(e1.getSource(), b);
harness.check(e1.getPropertyName(), "rolloverSelectedIcon");
harness.check(e1.getOldValue(), null);
harness.check(e1.getNewValue(), icon1);
PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
harness.check(e2.getSource(), b);
harness.check(e2.getPropertyName(), "rolloverEnabled");
harness.check(e2.getOldValue(), Boolean.FALSE);
harness.check(e2.getNewValue(), Boolean.TRUE);
// change the icon
events.clear();
b.setRolloverSelectedIcon(icon2);
harness.check(b.getRolloverSelectedIcon(), icon2);
harness.check(events.size(), 1);
e1 = (PropertyChangeEvent) events.get(0);
harness.check(e1.getSource(), b);
harness.check(e1.getPropertyName(), "rolloverSelectedIcon");
harness.check(e1.getOldValue(), icon1);
harness.check(e1.getNewValue(), icon2);
// setting the same icon should generate no event
events.clear();
b.setRolloverSelectedIcon(icon2);
harness.check(events.size(), 0);
// set to null
b.setRolloverSelectedIcon(null);
harness.check(b.getRolloverSelectedIcon(), null);
harness.check(b.isRolloverEnabled(), true);
harness.check(events.size(), 1);
e1 = (PropertyChangeEvent) events.get(0);
harness.check(e1.getSource(), b);
harness.check(e1.getPropertyName(), "rolloverSelectedIcon");
harness.check(e1.getOldValue(), icon2);