public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: javax.swing.event.SwingPropertyChangeSupport - small test fixes
@ 2006-01-28 23:06 David Gilbert
  0 siblings, 0 replies; only message in thread
From: David Gilbert @ 2006-01-28 23:06 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

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

[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 3500 bytes --]

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);
     

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-28 23:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-28 23:06 FYI: javax.swing.event.SwingPropertyChangeSupport - small test fixes David Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).