label.addPropertyChangeListener(this);
label.setText("CAB");
harness.check(label.getText(), "CAB");
harness.check(label.getDisplayedMnemonicIndex(), 0);
harness.check(events.size(), 2);
PropertyChangeEvent e0 = (PropertyChangeEvent) events.get(0);
harness.check(e0.getSource(), label);
harness.check(e0.getPropertyName(), "text");
harness.check(e0.getOldValue(), "ABC");
harness.check(e0.getNewValue(), "CAB");
PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(1);
if (e1.getPropertyName().equals("html"))
e1 = (PropertyChangeEvent) events.get(2);
harness.check(e1.getSource(), label);
harness.check(e1.getPropertyName(), "displayedMnemonicIndex");
harness.check(e1.getOldValue(), new Integer(2));
harness.check(e1.getNewValue(), new Integer(0));
// setting the same again should generate no event
events.clear();
label.setText("CAB");
harness.check(events.size(), 0);
// check null
events.clear();
label.setText(null);
harness.check(label.getText(), null);
harness.check(label.getDisplayedMnemonicIndex(), -1);
harness.check(events.size(), 2);
e0 = (PropertyChangeEvent) events.get(0);
harness.check(e0.getSource(), label);
harness.check(e0.getPropertyName(), "text");
harness.check(e0.getOldValue(), "CAB");
harness.check(e0.getNewValue(), null);
e1 = (PropertyChangeEvent) events.get(1);
if (e1.getPropertyName().equals("html"))
e1 = (PropertyChangeEvent) events.get(2);
harness.check(e1.getSource(), label);
harness.check(e1.getPropertyName(), "displayedMnemonicIndex");
harness.check(e1.getOldValue(), new Integer(0));
harness.check(e1.getNewValue(), new Integer(-1));
}