* FYI: TextArea and TextField constructors - new tests
@ 2006-06-30 9:18 David Gilbert
0 siblings, 0 replies; only message in thread
From: David Gilbert @ 2006-06-30 9:18 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 375 bytes --]
This patch (committed) adds some checks for the constructors in the TextArea and
TextField classes, which I wrote while looking over a proposed patch from Tania Bento:
2006-06-30 David Gilbert <david.gilbert@object-refinery.com>
* gnu/testlet/java/awt/TextArea/constructors.java: New test,
* gnu/testlet/java/awt/TextField/constructors.java: New test.
Regards,
Dave
[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 10363 bytes --]
Index: gnu/testlet/java/awt/TextArea/constructors.java
===================================================================
RCS file: gnu/testlet/java/awt/TextArea/constructors.java
diff -N gnu/testlet/java/awt/TextArea/constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/TextArea/constructors.java 30 Jun 2006 09:05:07 -0000
@@ -0,0 +1,178 @@
+/* constructors.java -- some checks for the constructors in the TextField
+ 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.1
+
+package gnu.testlet.java.awt.TextArea;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.TextArea;
+
+public class constructors implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ testConstructor1(harness);
+ testConstructor2(harness);
+ testConstructor3(harness);
+ testConstructor4(harness);
+ }
+
+ public void testConstructor1(TestHarness harness)
+ {
+ harness.checkPoint("()");
+ TextArea ta = new TextArea();
+ harness.check(ta.getText(), "");
+ harness.check(ta.isEditable());
+ harness.check(ta.getColumns(), 0);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
+ }
+
+ public void testConstructor2(TestHarness harness)
+ {
+ harness.checkPoint("(int, int)");
+ TextArea ta = new TextArea(3, 7);
+ harness.check(ta.getText(), "");
+ harness.check(ta.isEditable());
+ harness.check(ta.getColumns(), 7);
+ harness.check(ta.getRows(), 3);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
+
+ // try negative rows
+ ta = new TextArea(-1, 7);
+ harness.check(ta.getText(), "");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 0);
+ harness.check(ta.getColumns(), 7);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
+
+ // try negative columns
+ ta = new TextArea(3, -7);
+ harness.check(ta.getText(), "");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 3);
+ harness.check(ta.getColumns(), 0);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
+ }
+
+ public void testConstructor3(TestHarness harness)
+ {
+ harness.checkPoint("(String)");
+ TextArea ta = new TextArea("ABC");
+ harness.check(ta.getText(), "ABC");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 0);
+ harness.check(ta.getColumns(), 0);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
+
+ // try null
+ ta = new TextArea(null);
+ harness.check(ta.getText(), "");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 0);
+ harness.check(ta.getColumns(), 0);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
+ }
+
+ public void testConstructor4(TestHarness harness)
+ {
+ harness.checkPoint("(String, int, int)");
+ TextArea ta = new TextArea("ABC", 3, 7);
+ harness.check(ta.getText(), "ABC");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 3);
+ harness.check(ta.getColumns(), 7);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
+
+ // try null
+ ta = new TextArea(null, 3, 7);
+ harness.check(ta.getText(), "");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 3);
+ harness.check(ta.getColumns(), 7);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
+
+ // try negative rows
+ ta = new TextArea("ABC", -3, 7);
+ harness.check(ta.getText(), "ABC");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 0);
+ harness.check(ta.getColumns(), 7);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
+
+ // try negative columns
+ ta = new TextArea("ABC", 3, -7);
+ harness.check(ta.getText(), "ABC");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 3);
+ harness.check(ta.getColumns(), 0);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
+ }
+
+ public void testConstructor5(TestHarness harness)
+ {
+ harness.checkPoint("(String, int, int, int)");
+ TextArea ta = new TextArea("ABC", 3, 7, TextArea.SCROLLBARS_VERTICAL_ONLY);
+ harness.check(ta.getText(), "ABC");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 3);
+ harness.check(ta.getColumns(), 7);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_VERTICAL_ONLY);
+
+ // try null
+ ta = new TextArea(null, 3, 7, TextArea.SCROLLBARS_VERTICAL_ONLY);
+ harness.check(ta.getText(), "");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 3);
+ harness.check(ta.getColumns(), 7);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_VERTICAL_ONLY);
+
+ // try negative rows
+ ta = new TextArea("ABC", -3, 7, TextArea.SCROLLBARS_VERTICAL_ONLY);
+ harness.check(ta.getText(), "ABC");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 0);
+ harness.check(ta.getColumns(), 7);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_VERTICAL_ONLY);
+
+ // try negative columns
+ ta = new TextArea("ABC", 3, -7, TextArea.SCROLLBARS_VERTICAL_ONLY);
+ harness.check(ta.getText(), "ABC");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 3);
+ harness.check(ta.getColumns(), 0);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_VERTICAL_ONLY);
+
+ // try bad scroll bar visibility
+ ta = new TextArea("ABC", 3, -7, 999);
+ harness.check(ta.getText(), "ABC");
+ harness.check(ta.isEditable());
+ harness.check(ta.getRows(), 3);
+ harness.check(ta.getColumns(), 0);
+ harness.check(ta.getScrollbarVisibility(), TextArea.SCROLLBARS_BOTH);
+
+
+ }
+
+}
Index: gnu/testlet/java/awt/TextField/constructors.java
===================================================================
RCS file: gnu/testlet/java/awt/TextField/constructors.java
diff -N gnu/testlet/java/awt/TextField/constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/TextField/constructors.java 30 Jun 2006 09:05:07 -0000
@@ -0,0 +1,109 @@
+/* constructors.java -- some checks for the constructors in the TextField
+ 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.0
+
+package gnu.testlet.java.awt.TextField;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.TextField;
+
+public class constructors implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ testConstructor1(harness);
+ testConstructor2(harness);
+ testConstructor3(harness);
+ testConstructor4(harness);
+ }
+
+ public void testConstructor1(TestHarness harness)
+ {
+ harness.checkPoint("()");
+ TextField tf = new TextField();
+ harness.check(tf.getText(), "");
+ harness.check(tf.isEditable());
+ harness.check(tf.getColumns(), 0);
+ harness.check(tf.getEchoChar(), 0);
+ }
+
+ public void testConstructor2(TestHarness harness)
+ {
+ harness.checkPoint("(int)");
+ TextField tf = new TextField(3);
+ harness.check(tf.getText(), "");
+ harness.check(tf.isEditable());
+ harness.check(tf.getColumns(), 3);
+ harness.check(tf.getEchoChar(), 0);
+
+ // try negative columns
+ tf = new TextField(-1);
+ harness.check(tf.getText(), "");
+ harness.check(tf.isEditable());
+ harness.check(tf.getColumns(), 0);
+ harness.check(tf.getEchoChar(), 0);
+ }
+
+ public void testConstructor3(TestHarness harness)
+ {
+ harness.checkPoint("(String)");
+ TextField tf = new TextField("ABC");
+ harness.check(tf.getText(), "ABC");
+ harness.check(tf.isEditable());
+ harness.check(tf.getColumns(), 3);
+ harness.check(tf.getEchoChar(), 0);
+
+ // try null
+ tf = new TextField(null);
+ harness.check(tf.getText(), "");
+ harness.check(tf.isEditable());
+ harness.check(tf.getColumns(), 0);
+ harness.check(tf.getEchoChar(), 0);
+ }
+
+ public void testConstructor4(TestHarness harness)
+ {
+ harness.checkPoint("(String, int)");
+ TextField tf = new TextField("ABC", 3);
+ harness.check(tf.getText(), "ABC");
+ harness.check(tf.isEditable());
+ harness.check(tf.getColumns(), 3);
+ harness.check(tf.getEchoChar(), 0);
+
+ // try null
+ tf = new TextField(null, 3);
+ harness.check(tf.getText(), "");
+ harness.check(tf.isEditable());
+ harness.check(tf.getColumns(), 3);
+ harness.check(tf.getEchoChar(), 0);
+
+ // try negative columns
+ tf = new TextField("ABC", -3);
+ harness.check(tf.getText(), "ABC");
+ harness.check(tf.isEditable());
+ harness.check(tf.getColumns(), 0);
+ harness.check(tf.getEchoChar(), 0);
+ }
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-06-30 9:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-30 9:18 FYI: TextArea and TextField constructors - 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).