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

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

I committed the following new tests:

2006-02-15  David Gilbert  <david.gilbert@object-refinery.com>

    * gnu/testlet/javax/swing/JSpinner/NumberEditor/constructors.java: 
New test,
    * gnu/testlet/javax/swing/JSpinner/NumberEditor/getFormat.java: 
Likewise,
    * gnu/testlet/javax/swing/JSpinner/NumberEditor/getModel.java: Likewise.

Regards,

Dave

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

Index: gnu/testlet/javax/swing/JSpinner/NumberEditor/constructors.java
===================================================================
RCS file: gnu/testlet/javax/swing/JSpinner/NumberEditor/constructors.java
diff -N gnu/testlet/javax/swing/JSpinner/NumberEditor/constructors.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JSpinner/NumberEditor/constructors.java	15 Feb 2006 15:09:33 -0000
@@ -0,0 +1,112 @@
+/* constructors.java -- Checks for the constructors in the NumberEditor 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.4
+
+package gnu.testlet.javax.swing.JSpinner.NumberEditor;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import javax.swing.JFormattedTextField;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.text.NumberFormatter;
+
+public class constructors implements Testlet 
+{
+  public void test(TestHarness harness)
+  {
+    testConstructor1(harness);
+    testConstructor2(harness);
+  }
+  
+  public void testConstructor1(TestHarness harness)
+  {
+    harness.checkPoint("(JSpinner)");
+    JSpinner s = new JSpinner();
+    JSpinner.NumberEditor e = new JSpinner.NumberEditor(s);
+    harness.check(e.getLayout(), e);
+    harness.check(e.getFormat(), NumberFormat.getInstance());
+    JFormattedTextField ftf = e.getTextField();
+    NumberFormatter nf = (NumberFormatter) ftf.getFormatter();
+    harness.check(nf.getMinimum(), null);
+    harness.check(nf.getMaximum(), null);
+    
+    SpinnerNumberModel m = new SpinnerNumberModel(50.0, 0.0, 100.0, 5.0);
+    s = new JSpinner(m);
+    e = new JSpinner.NumberEditor(s);
+    harness.check(e.getFormat(), NumberFormat.getInstance());
+    ftf = e.getTextField();
+    nf = (NumberFormatter) ftf.getFormatter();
+    harness.check(nf.getMinimum(), new Double(0.0));
+    harness.check(nf.getMaximum(), new Double(100.0));
+    
+    // try null argument
+    boolean pass = false;
+    try
+      {
+        e = new JSpinner.NumberEditor(null);  
+      }
+    catch (NullPointerException npe)
+      {
+        pass = true;
+      }
+    harness.check(pass);
+  }
+
+  public void testConstructor2(TestHarness harness)
+  {
+    harness.checkPoint("(JSpinner, String)"); 
+    JSpinner s = new JSpinner();
+    JSpinner.NumberEditor e = new JSpinner.NumberEditor(s, "0.00");
+    harness.check(e.getLayout(), e);
+    harness.check(e.getFormat(), new DecimalFormat("0.00"));
+    
+    // try null spinner argument
+    boolean pass = false;
+    try
+      {
+        e = new JSpinner.NumberEditor(null, "0.00");  
+      }
+    catch (NullPointerException npe)
+      {
+        pass = true;
+      }
+    harness.check(pass);
+
+    // try null format argument
+    pass = false;
+    try
+      {
+        e = new JSpinner.NumberEditor(s, null);  
+      }
+    catch (NullPointerException npe)
+      {
+        pass = true;
+      }
+    harness.check(pass);  
+  }
+
+}
Index: gnu/testlet/javax/swing/JSpinner/NumberEditor/getFormat.java
===================================================================
RCS file: gnu/testlet/javax/swing/JSpinner/NumberEditor/getFormat.java
diff -N gnu/testlet/javax/swing/JSpinner/NumberEditor/getFormat.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JSpinner/NumberEditor/getFormat.java	15 Feb 2006 15:09:33 -0000
@@ -0,0 +1,47 @@
+/* getFormat.java -- Checks for the getFormat() method in the NumberEditor 
+   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.4
+
+package gnu.testlet.javax.swing.JSpinner.NumberEditor;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.text.NumberFormat;
+
+import javax.swing.JSpinner;
+import javax.swing.text.DefaultFormatterFactory;
+
+public class getFormat implements Testlet 
+{
+  public void test(TestHarness harness)
+  {
+    harness.checkPoint("()");
+    JSpinner s = new JSpinner();
+    JSpinner.NumberEditor e = new JSpinner.NumberEditor(s);
+    harness.check(e.getTextField().getFormatterFactory() 
+        instanceof DefaultFormatterFactory);
+    harness.check(e.getFormat(), NumberFormat.getInstance());
+  }
+
+}
Index: gnu/testlet/javax/swing/JSpinner/NumberEditor/getModel.java
===================================================================
RCS file: gnu/testlet/javax/swing/JSpinner/NumberEditor/getModel.java
diff -N gnu/testlet/javax/swing/JSpinner/NumberEditor/getModel.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JSpinner/NumberEditor/getModel.java	15 Feb 2006 15:09:34 -0000
@@ -0,0 +1,44 @@
+/* getModel.java -- Checks for the getModel() method in the 
+                    JSpinner.NumberEditor 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.4
+
+package gnu.testlet.javax.swing.JSpinner.NumberEditor;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+
+public class getModel implements Testlet 
+{
+
+  public void test(TestHarness harness) 
+  {
+    harness.checkPoint("()");
+    SpinnerNumberModel m = new SpinnerNumberModel(50.0, 0.0, 100.0, 5.0);
+    JSpinner s = new JSpinner(m);
+    JSpinner.NumberEditor editor = (JSpinner.NumberEditor) s.getEditor();
+    harness.check(editor.getModel(), m);
+  }
+}

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

only message in thread, other threads:[~2006-02-15 15:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-15 15:13 FYI: JSpinner.NumberEditor - 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).