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: javax.swing.event.SwingPropertyChangeSupport - small test fixes


I committed this patch - the 1.5.0 API docs state the behaviour for null arguments:

2006-01-28 David Gilbert <david.gilbert@object-refinery.com>

* gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/hasListeners.java
(test): Corrected test for null argument,
* gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/removePropertyChangeListener.java
(test2): Likewise.


Regards,

Dave
Index: gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/hasListeners.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/hasListeners.java,v
retrieving revision 1.1
diff -u -r1.1 hasListeners.java
--- gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/hasListeners.java	23 Aug 2005 09:54:09 -0000	1.1
+++ gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/hasListeners.java	28 Jan 2006 23:00:02 -0000
@@ -13,9 +13,9 @@
 // GNU General Public License for more details.
 
 // You should have received a copy of the GNU General Public License
-// along with Mauve; see the file COPYING.  If not, write to
-// the Free Software Foundation, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.  */
+// along with Mauve; see the file COPYING.  If not, write to the
+// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301 USA.
 
 package gnu.testlet.javax.swing.event.SwingPropertyChangeSupport;
 
@@ -55,17 +55,15 @@
     s.removePropertyChangeListener("X", this);
     harness.check(s.hasListeners("X"), false);
     
-    // check null argument
-    boolean pass = false;
-    try
-    {
-      s.hasListeners(null);
-    }
-    catch (NullPointerException e)
-    {
-      pass = true;
-    }
-    harness.check(pass);
+    // check null argument - in 1.5.0 the spec says that this checks for 
+    // listeners registered against all properties
+    harness.check(s.hasListeners(null), false);
+    
+    // add a listener for all events
+    s.addPropertyChangeListener(this);
+    harness.check(s.hasListeners(null));
+    s.removePropertyChangeListener(this);
+    harness.check(s.hasListeners(null), false); 
   }
 
   public void propertyChange(PropertyChangeEvent e)
Index: gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/removePropertyChangeListener.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/removePropertyChangeListener.java,v
retrieving revision 1.1
diff -u -r1.1 removePropertyChangeListener.java
--- gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/removePropertyChangeListener.java	23 Aug 2005 09:54:09 -0000	1.1
+++ gnu/testlet/javax/swing/event/SwingPropertyChangeSupport/removePropertyChangeListener.java	28 Jan 2006 23:00:02 -0000
@@ -13,9 +13,9 @@
 // GNU General Public License for more details.
 
 // You should have received a copy of the GNU General Public License
-// along with Mauve; see the file COPYING.  If not, write to
-// the Free Software Foundation, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.  */
+// along with Mauve; see the file COPYING.  If not, write to the
+// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301 USA.
 
 package gnu.testlet.javax.swing.event.SwingPropertyChangeSupport;
 
@@ -87,15 +87,17 @@
     // remove a listener that doesn't exist
     s.removePropertyChangeListener("X", this);
     
-    // try a null argument 1
+    // according to the 1.5.0 spec, a null property name causes no action
+    // or exception
     boolean pass = false;
     try
     {
       s.removePropertyChangeListener(null, this);
+      pass = true;
     }
-    catch (NullPointerException e)
+    catch (Exception e)
     {
-      pass = true;
+      pass = false;
     }
     harness.check(pass);
     

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