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.UIManager test fixes


A couple of tests were failing because they assumed the UIManager was in a clean state, whereas in fact it can be updated by tests run previously. This patch is committed:

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

   * gnu/testlet/javax/swing/UIManager/addPropertyChangeListener.java
   (test): Don't assume there are zero listeners at start of test,
   * gnu/testlet/javax/swing/UIManager/getPropertyChangeListeners.java
   (test): Likewise.

Regards,

Dave
Index: gnu/testlet/javax/swing/UIManager/addPropertyChangeListener.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/UIManager/addPropertyChangeListener.java,v
retrieving revision 1.1
diff -u -r1.1 addPropertyChangeListener.java
--- gnu/testlet/javax/swing/UIManager/addPropertyChangeListener.java	23 Aug 2005 13:53:36 -0000	1.1
+++ gnu/testlet/javax/swing/UIManager/addPropertyChangeListener.java	28 Jan 2006 22:26:12 -0000
@@ -1,6 +1,6 @@
 // Tags: JDK1.4
 
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006 David Gilbert <david.gilbert@object-refinery.com>
 
 // Mauve is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -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.UIManager;
 
@@ -42,17 +42,17 @@
   {
     // check that there are no listeners
     PropertyChangeListener[] listeners = UIManager.getPropertyChangeListeners();
-    harness.check(listeners.length, 0);
+    int count = listeners.length;
     
     // now add a listener
     UIManager.addPropertyChangeListener(this);
     listeners = UIManager.getPropertyChangeListeners();;
-    harness.check(listeners.length, 1);
-    harness.check(listeners[0], this);
+    harness.check(listeners.length, count + 1);
+    harness.check(listeners[count], this);
     
     // try adding a null listener - it gets silently ignored
     UIManager.addPropertyChangeListener(null);
-    harness.check(listeners.length, 1);
+    harness.check(listeners.length, count + 1);
   }
 
   public void propertyChange(PropertyChangeEvent e)
Index: gnu/testlet/javax/swing/UIManager/getPropertyChangeListeners.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/UIManager/getPropertyChangeListeners.java,v
retrieving revision 1.1
diff -u -r1.1 getPropertyChangeListeners.java
--- gnu/testlet/javax/swing/UIManager/getPropertyChangeListeners.java	23 Aug 2005 13:53:36 -0000	1.1
+++ gnu/testlet/javax/swing/UIManager/getPropertyChangeListeners.java	28 Jan 2006 22:26:12 -0000
@@ -1,6 +1,6 @@
 // Tags: JDK1.4
 
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006 David Gilbert <david.gilbert@object-refinery.com>
 
 // Mauve is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -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.UIManager;
 
@@ -42,13 +42,13 @@
   {
     // check that there are no listeners
     PropertyChangeListener[] listeners = UIManager.getPropertyChangeListeners();
-    harness.check(listeners.length, 0);
+    int count = listeners.length;
     
     // now add a listener
     UIManager.addPropertyChangeListener(this);
     listeners = UIManager.getPropertyChangeListeners();;
-    harness.check(listeners.length, 1);
-    harness.check(listeners[0], this);
+    harness.check(listeners.length, count + 1);
+    harness.check(listeners[count], this);
     
   }
 

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