public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: ListDataEvent - new tests
@ 2006-06-16 13:24 David Gilbert
  0 siblings, 0 replies; only message in thread
From: David Gilbert @ 2006-06-16 13:24 UTC (permalink / raw)
  To: mauve-patches

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

This patch (committed) adds new tests for the ListDataEvent class:

2006-06-16  David Gilbert  <david.gilbert@object-refinery.com>

    * gnu/testlet/javax/swing/event/ListDataEvent/constructor.java: New 
file,
    * gnu/testlet/javax/swing/event/ListDataEvent/getIndex0.java: New file,
    * gnu/testlet/javax/swing/event/ListDataEvent/getIndex1.java: New file,
    * gnu/testlet/javax/swing/event/ListDataEvent/getSource.java: New file,
    * gnu/testlet/javax/swing/event/ListDataEvent/getType.java: New file,
    * gnu/testlet/javax/swing/event/ListDataEvent/toString.java: New file.

I already committed a patch to GNU Classpath CVS to fix the failing tests.

Regards,

Dave

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

Index: gnu/testlet/javax/swing/event/ListDataEvent/constructor.java
===================================================================
RCS file: gnu/testlet/javax/swing/event/ListDataEvent/constructor.java
diff -N gnu/testlet/javax/swing/event/ListDataEvent/constructor.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/event/ListDataEvent/constructor.java	16 Jun 2006 13:20:26 -0000
@@ -0,0 +1,74 @@
+/* constructor.java -- some checks for the constructor in the ListDataEvent 
+       class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+Mauve is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+Mauve is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+*/
+
+// Tags: JDK1.2
+
+package gnu.testlet.javax.swing.event.ListDataEvent;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.event.ListDataEvent;
+
+public class constructor implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    ListDataEvent e = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 
+            1, 2);
+    harness.check(e.getSource(), this);
+    harness.check(e.getType(), ListDataEvent.CONTENTS_CHANGED);
+    harness.check(e.getIndex0(), 1);
+    harness.check(e.getIndex1(), 2);
+    
+    // try null source
+    boolean pass = false;
+    try
+    {
+      e = new ListDataEvent(null, ListDataEvent.CONTENTS_CHANGED, 1, 2);
+    }
+    catch (IllegalArgumentException ex)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // try first index greater than second
+    e = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 99, 2);
+    harness.check(e.getIndex0(), 2);
+    harness.check(e.getIndex1(), 99);
+    
+    // try bad type
+    e = new ListDataEvent(this, -99, 1, 2);
+    harness.check(e.getType(), -99);
+    
+    // try negative first index
+    e = new ListDataEvent(this, -ListDataEvent.CONTENTS_CHANGED, -10, 2);
+    harness.check(e.getIndex0(), -10);
+    harness.check(e.getIndex1(), 2);
+    
+    // try negative second index
+    e = new ListDataEvent(this, -ListDataEvent.CONTENTS_CHANGED, 1, -2);
+    harness.check(e.getIndex0(), -2);
+    harness.check(e.getIndex1(), 1);
+  }
+}
Index: gnu/testlet/javax/swing/event/ListDataEvent/getIndex0.java
===================================================================
RCS file: gnu/testlet/javax/swing/event/ListDataEvent/getIndex0.java
diff -N gnu/testlet/javax/swing/event/ListDataEvent/getIndex0.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/event/ListDataEvent/getIndex0.java	16 Jun 2006 13:20:26 -0000
@@ -0,0 +1,42 @@
+/* getIndex0.java -- some checks for the getIndex0() method in the 
+       ListDataEvent class.
+   Copyright (C) 2006 David Gilbert  <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+Mauve is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+Mauve is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+*/
+
+// Tags: JDK1.2
+
+package gnu.testlet.javax.swing.event.ListDataEvent;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.event.ListDataEvent;
+
+public class getIndex0 implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 
+            1, 2);
+    harness.check(e.getIndex0(), 1);
+    e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 4, 3);
+    harness.check(e.getIndex0(), 3);
+  }
+}
Index: gnu/testlet/javax/swing/event/ListDataEvent/getIndex1.java
===================================================================
RCS file: gnu/testlet/javax/swing/event/ListDataEvent/getIndex1.java
diff -N gnu/testlet/javax/swing/event/ListDataEvent/getIndex1.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/event/ListDataEvent/getIndex1.java	16 Jun 2006 13:20:26 -0000
@@ -0,0 +1,42 @@
+/* getIndex1.java -- some checks for the getIndex1() method in the 
+       ListDataEvent class.
+   Copyright (C) 2006 David Gilbert  <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+Mauve is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+Mauve is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+*/
+
+// Tags: JDK1.2
+
+package gnu.testlet.javax.swing.event.ListDataEvent;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.event.ListDataEvent;
+
+public class getIndex1 implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 
+            1, 2);
+    harness.check(e.getIndex1(), 2);
+    e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 4, 3);
+    harness.check(e.getIndex1(), 4);
+  }
+}
Index: gnu/testlet/javax/swing/event/ListDataEvent/getSource.java
===================================================================
RCS file: gnu/testlet/javax/swing/event/ListDataEvent/getSource.java
diff -N gnu/testlet/javax/swing/event/ListDataEvent/getSource.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/event/ListDataEvent/getSource.java	16 Jun 2006 13:20:26 -0000
@@ -0,0 +1,40 @@
+/* getSource.java -- some checks for the getSource() method in the 
+       ListDataEvent class.
+   Copyright (C) 2006 David Gilbert  <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+Mauve is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+Mauve is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+*/
+
+// Tags: JDK1.2
+
+package gnu.testlet.javax.swing.event.ListDataEvent;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.event.ListDataEvent;
+
+public class getSource implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 
+            1, 2);
+    harness.check(e.getSource(), this);
+  }
+}
Index: gnu/testlet/javax/swing/event/ListDataEvent/getType.java
===================================================================
RCS file: gnu/testlet/javax/swing/event/ListDataEvent/getType.java
diff -N gnu/testlet/javax/swing/event/ListDataEvent/getType.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/event/ListDataEvent/getType.java	16 Jun 2006 13:20:26 -0000
@@ -0,0 +1,40 @@
+/* getType.java -- some checks for the getType() method in the 
+       ListDataEvent class.
+   Copyright (C) 2006 David Gilbert  <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+Mauve is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+Mauve is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+*/
+
+// Tags: JDK1.2
+
+package gnu.testlet.javax.swing.event.ListDataEvent;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.event.ListDataEvent;
+
+public class getType implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 
+            1, 2);
+    harness.check(e.getType(), ListDataEvent.INTERVAL_REMOVED);
+  }
+}
Index: gnu/testlet/javax/swing/event/ListDataEvent/toString.java
===================================================================
RCS file: gnu/testlet/javax/swing/event/ListDataEvent/toString.java
diff -N gnu/testlet/javax/swing/event/ListDataEvent/toString.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/event/ListDataEvent/toString.java	16 Jun 2006 13:20:26 -0000
@@ -0,0 +1,44 @@
+/* getIndex0.java -- some checks for the toString() method in the 
+       ListDataEvent class.
+   Copyright (C) 2006 David Gilbert  <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+Mauve is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+Mauve is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+*/
+
+// Tags: JDK1.2
+
+package gnu.testlet.javax.swing.event.ListDataEvent;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.event.ListDataEvent;
+
+public class toString implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 
+            1, 2);
+    harness.check(e.toString(), 
+            "javax.swing.event.ListDataEvent[type=2,index0=1,index1=2]");
+    e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 4, 3);
+    harness.check(e.toString(), 
+            "javax.swing.event.ListDataEvent[type=2,index0=3,index1=4]");
+  }
+}

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

only message in thread, other threads:[~2006-06-16 13:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-16 13:24 FYI: ListDataEvent - new tests 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).