This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: SwingPropertyChangeSupport.firePropertyChange()


I added some additional checks for this method to back up a patch I committed to GNU Classpath:

2005-10-12 David Gilbert <david.gilbert@object-refinery.com>

* gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/firePropertyChange.java
(test1): added checks for old and new values the same, and old and new
values both null.


Regards,

Dave Gilbert
Index: gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/firePropertyChange.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/firePropertyChange.java,v
retrieving revision 1.1
diff -u -r1.1 firePropertyChange.java
--- gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/firePropertyChange.java	23 Aug 2005 09:54:09 -0000	1.1
+++ gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/firePropertyChange.java	12 Oct 2005 09:09:15 -0000
@@ -60,6 +60,21 @@
     harness.check(this.lastEvent.getPropertyName(), "X");
     harness.check(this.lastEvent.getOldValue(), "Y");
     harness.check(this.lastEvent.getNewValue(), "Z");
+    
+    // if the old and new values are the same (and non-null), then no listeners
+    // are notified
+    this.lastEvent = null;
+    e = new PropertyChangeEvent("SOURCE", "X", "YY", "YY");
+    s.firePropertyChange(e);
+    harness.check(lastEvent, null);
+    
+    // but if the old and new values are both null, listeners ARE notified
+    this.lastEvent = null;
+    e = new PropertyChangeEvent("SOURCE", "X", null, null);
+    s.firePropertyChange(e);
+    harness.check(lastEvent, e);    
+    
+    // check that a null argument throws a null pointer exception
     this.lastEvent = null;
     boolean pass = false;
     try

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]