This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: some tests for SimpleAttributeSet
- From: David Gilbert <david dot gilbert at object-refinery dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Fri, 13 Jan 2006 15:01:14 +0000
- Subject: FYI: some tests for SimpleAttributeSet
I committed these new checks:
2006-01-13 David Gilbert <david.gilbert@object-refinery.com>
* gnu/testlet/javax/swing/text/SimpleAttributeSet/addAttribute.java:
New file,
*
gnu/testlet/javax/swing/text/SimpleAttributeSet/addAttributes.java:
Likewise,
* gnu/testlet/javax/swing/text/SimpleAttributeSet/clone.java: Likewise,
* gnu/testlet/javax/swing/text/SimpleAttributeSet/constructors.java:
Likewise,
*
gnu/testlet/javax/swing/text/SimpleAttributeSet/containsAttribute.java:
Likewise,
*
gnu/testlet/javax/swing/text/SimpleAttributeSet/containsAttributes.java:
Likewise,
*
gnu/testlet/javax/swing/text/SimpleAttributeSet/copyAttributes.java:
Likewise,
* gnu/testlet/javax/swing/text/SimpleAttributeSet/EMPTY.java: Likewise,
* gnu/testlet/javax/swing/text/SimpleAttributeSet/equals.java: Likewise,
* gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttribute.java:
Likewise,
*
gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttributeCount.java:
Likewise,
*
gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttributeNames.java:
Likewise,
*
gnu/testlet/javax/swing/text/SimpleAttributeSet/getResolveParent.java:
Likewise,
* gnu/testlet/javax/swing/text/SimpleAttributeSet/isDefined.java:
Likewise,
* gnu/testlet/javax/swing/text/SimpleAttributeSet/isEmpty.java:
Likewise,
* gnu/testlet/javax/swing/text/SimpleAttributeSet/isEqual.java:
Likewise,
*
gnu/testlet/javax/swing/text/SimpleAttributeSet/removeAttribute.java:
Likewise,
*
gnu/testlet/javax/swing/text/SimpleAttributeSet/removeAttributes.java:
Likewise,
*
gnu/testlet/javax/swing/text/SimpleAttributeSet/setResolveParent.java:
Likewise.
Regards,
Dave
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/EMPTY.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/EMPTY.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/EMPTY.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/EMPTY.java 13 Jan 2006 14:50:53 -0000
@@ -0,0 +1,59 @@
+/* EMPTY.java -- Tests for the EMPTY field
+ 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the {@link EMPTY} field in the {@link SimpleAttributeSet}
+ * class.
+ */
+public class EMPTY implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("EMPTY");
+
+ // check that it is empty
+ harness.check(SimpleAttributeSet.EMPTY.getAttributeCount(), 0);
+ harness.check(SimpleAttributeSet.EMPTY.getResolveParent(), null);
+
+ // EMPTY should not be an instance of SimpleAttributeSet, since then
+ // you could cast it and add attributes to it...
+ harness.check(SimpleAttributeSet.EMPTY instanceof SimpleAttributeSet,
+ false);
+
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/addAttribute.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/addAttribute.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/addAttribute.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/addAttribute.java 13 Jan 2006 14:50:53 -0000
@@ -0,0 +1,108 @@
+/* addAttribute.java -- Tests for the addAttribute() method in the
+ SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the addAttribute() method in the {@link SimpleAttributeSet}
+ * class.
+ */
+public class addAttribute implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("addAttribute()");
+
+ SimpleAttributeSet s = new SimpleAttributeSet();
+
+ // add an attribute, check that you can retrieve it
+ s.addAttribute("X1", "Y1");
+ harness.check(s.getAttribute("X1"), "Y1");
+
+ // add an attribute that already exists, same value
+ s.addAttribute("X1", "Y1");
+ harness.check(s.getAttributeCount(), 1);
+
+ // add an attribute that already exists, different value
+ s.addAttribute("X1", "YY1");
+ harness.check(s.getAttribute("X1"), "YY1");
+ harness.check(s.getAttributeCount(), 1);
+
+ // add an attribute that exists in the resolve parent, same value
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ sParent.addAttribute("X2", "Y2");
+ s.setResolveParent(sParent);
+ harness.check(s.getAttributeCount(), 2);
+
+ // this adds to s, not sParent
+ s.addAttribute("X2", "Y2");
+ harness.check(s.getAttribute("X2"), "Y2");
+ harness.check(s.getAttributeCount(), 3);
+
+ // add an attribute that exists in the resolve parent, different value
+ s.addAttribute("X2", "Z2");
+ harness.check(s.getAttribute("X2"), "Z2");
+ harness.check(s.getAttributeCount(), 3);
+ harness.check(sParent.getAttribute("X2"), "Y2");
+ harness.check(sParent.getAttributeCount(), 1);
+
+ // try null attribute key
+ boolean pass = false;
+ try
+ {
+ s.addAttribute(null, "XX");
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try null value
+ pass = false;
+ try
+ {
+ s.addAttribute("X2", null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/addAttributes.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/addAttributes.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/addAttributes.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/addAttributes.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,90 @@
+/* addAttributes.java -- Tests for the addAttributes() method in the
+ SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the addAttributes() method in the {@link SimpleAttributeSet}
+ * class.
+ */
+public class addAttributes implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("addAttributes()");
+
+ // try an empty set
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ s.addAttributes(SimpleAttributeSet.EMPTY);
+ harness.check(s.isEmpty());
+
+ // try a set with no resolve parent and a couple of attributes
+ SimpleAttributeSet atts1 = new SimpleAttributeSet();
+ atts1.addAttribute("A1", "B1");
+ atts1.addAttribute("A2", "B2");
+ s.addAttributes(atts1);
+ harness.check(s.getAttributeCount(), 2);
+ harness.check(s.containsAttribute("A1", "B1"));
+ harness.check(s.containsAttribute("A2", "B2"));
+
+ // try a set with a resolve parent
+ SimpleAttributeSet atts2 = new SimpleAttributeSet();
+ atts2.addAttribute("C1", "D1");
+ atts1.addAttribute("A1", "BB1");
+ atts1.addAttribute("A2", "BB2");
+ atts1.setResolveParent(atts2);
+ s.addAttributes(atts1);
+ harness.check(s.getResolveParent(), atts2);
+ harness.check(s.getAttributeCount(), 3);
+ harness.check(s.containsAttribute("A1", "BB1"));
+ harness.check(s.containsAttribute("A2", "BB2"));
+ harness.check(s.containsAttribute("C1", "D1"));
+
+ // try a null set
+ boolean pass = false;
+ try
+ {
+ s.addAttributes(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/clone.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/clone.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/clone.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/clone.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,74 @@
+/* clone.java -- Tests for the clone() method in the SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the clone() method in the {@link SimpleAttributeSet}
+ * class.
+ */
+public class clone implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("clone()");
+
+ // clone an empty set
+ SimpleAttributeSet s1 = new SimpleAttributeSet();
+ SimpleAttributeSet s2 = (SimpleAttributeSet) s1.clone();
+ harness.check(s1.equals(s2));
+ s1.addAttribute("X1", "Y1");
+ harness.check(!s1.equals(s2));
+
+ // clone a set with no resolve parent
+ s2 = (SimpleAttributeSet) s1.clone();
+ harness.check(s1.equals(s2));
+ s1.addAttribute("X2", "Y2");
+ harness.check(!s1.equals(s2));
+
+ // clone a set with a resolve parent
+ SimpleAttributeSet s3 = new SimpleAttributeSet();
+ s3.addAttribute("A1", "B1");
+ s1.setResolveParent(s3);
+ s2 = (SimpleAttributeSet) s1.clone();
+ harness.check(s1.equals(s2));
+ s3.addAttribute("A1", "BB");
+ harness.check(s1.equals(s2));
+ s1.addAttribute("Y1", "-");
+ harness.check(!s1.equals(s2));
+
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/constructors.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/constructors.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/constructors.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,99 @@
+/* constructors.java -- Tests for the constructors
+ 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the constructors in the {@link SimpleAttributeSet} class.
+ */
+public class constructors implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ testConstructor1(harness);
+ testConstructor2(harness);
+ }
+
+ public void testConstructor1(TestHarness harness)
+ {
+ harness.checkPoint("SimpleAttributeSet()");
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ harness.check(s.isEmpty(), true);
+ harness.check(s.getResolveParent(), null);
+ }
+
+ public void testConstructor2(TestHarness harness)
+ {
+ harness.checkPoint("SimpleAttributeSet(AttributeSet)");
+
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ SimpleAttributeSet s1 = new SimpleAttributeSet(s);
+ harness.check(s1.isEmpty(), true);
+ harness.check(s1.getResolveParent(), null);
+
+ // adding to original set doesn't update new set
+ s.addAttribute("X1", "Y1");
+ harness.check(s1.isEmpty());
+ harness.check(s1.getResolveParent(), null);
+
+ SimpleAttributeSet s2 = new SimpleAttributeSet(s);
+ harness.check(s2.isEmpty(), false);
+ harness.check(s2.getResolveParent(), null);
+ harness.check(s2.getAttribute("X1"), "Y1");
+
+ SimpleAttributeSet ss = new SimpleAttributeSet();
+ ss.setResolveParent(s);
+ ss.addAttribute("X2", "Y2");
+
+ SimpleAttributeSet s3 = new SimpleAttributeSet(ss);
+ harness.check(s3.isEmpty(), false);
+ harness.check(s3.getResolveParent(), s);
+ harness.check(s3.getAttribute("X1"), "Y1");
+ harness.check(s3.getAttribute("X2"), "Y2");
+
+ // try null argument
+ boolean pass = false;
+ try
+ {
+ /*SimpleAttributeSet ss =*/ new SimpleAttributeSet(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/containsAttribute.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/containsAttribute.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/containsAttribute.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/containsAttribute.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,92 @@
+/* containsAttribute.java -- Tests for the containsAttribute() method in the
+ SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the containsAttribute() method in the
+ * {@link SimpleAttributeSet} class.
+ */
+public class containsAttribute implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("containsAttribute()");
+
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ harness.check(s.containsAttribute("X1", "Y1"), false);
+ s.addAttribute("X1", "Y1");
+ harness.check(s.containsAttribute("X1", "Y1"), true);
+ harness.check(s.containsAttribute("X1", "Y2"), false);
+ harness.check(s.containsAttribute("X2", "Y1"), false);
+
+ // check with resolve parent
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ sParent.addAttribute("X2", "Y2");
+ s.setResolveParent(sParent);
+ harness.check(s.containsAttribute("X1", "Y1"), true);
+ harness.check(s.containsAttribute("X2", "Y2"), true);
+ s.addAttribute("X2", "ZZ");
+ harness.check(s.containsAttribute("X2", "ZZ"), true);
+ harness.check(s.containsAttribute("X2", "Y2"), false);
+
+ // try null attribute key
+ boolean pass = false;
+ try
+ {
+ s.containsAttribute(null, "XX");
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try null value
+ pass = false;
+ try
+ {
+ s.containsAttribute("X2", null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/containsAttributes.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/containsAttributes.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/containsAttributes.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/containsAttributes.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,106 @@
+/* containsAttributes.java -- Tests for the containsAttributes() method in the
+ SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the containsAttributes() method in the
+ * {@link SimpleAttributeSet} class.
+ */
+public class containsAttributes implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("containsAttributes()");
+
+ // start with an empty set
+ SimpleAttributeSet s = new SimpleAttributeSet();
+
+ SimpleAttributeSet atts = new SimpleAttributeSet();
+ harness.check(s.containsAttributes(atts), true);
+
+ atts.addAttribute("E", "5");
+ harness.check(s.containsAttributes(atts), false);
+
+ // now populate the set and run some more tests
+ s.addAttribute("A", "1");
+ s.addAttribute("B", "2");
+ s.addAttribute("C", "3");
+ s.addAttribute("D", "4");
+ s.addAttribute("E", "5");
+ s.addAttribute("F", "6");
+
+ harness.check(s.containsAttributes(atts), true);
+ atts.addAttribute("E", "XXX");
+ harness.check(s.containsAttributes(atts), false);
+ atts.removeAttribute("E"); // atts is now empty
+ harness.check(s.containsAttributes(atts), true);
+
+ atts.addAttribute("A", "1");
+ atts.addAttribute("D", "4");
+ atts.addAttribute("E", "5");
+ harness.check(s.containsAttributes(atts), true);
+ atts.addAttribute("D", "XXX");
+ harness.check(s.containsAttributes(atts), false);
+
+ // now do some checks on the resolving parent
+ s = new SimpleAttributeSet();
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ s.setResolveParent(sParent);
+
+ atts = new SimpleAttributeSet();
+ harness.check(s.containsAttributes(atts), true);
+ atts.setResolveParent(sParent);
+ harness.check(s.containsAttributes(atts), true);
+
+ sParent.addAttribute("X", "1");
+ atts.addAttribute("X", "1");
+ harness.check(s.containsAttributes(atts));
+
+ // try null attributes
+ boolean pass = false;
+ try
+ {
+ s.containsAttributes(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/copyAttributes.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/copyAttributes.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/copyAttributes.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/copyAttributes.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,75 @@
+/* copyAttributes.java -- Tests for the copyAttributes() method in the
+ SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the copyAttributes() method in the {@link SimpleAttributeSet}
+ * class.
+ */
+public class copyAttributes implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("copyAttributes()");
+
+ // copy an empty set
+ SimpleAttributeSet s1 = new SimpleAttributeSet();
+ SimpleAttributeSet s2 = (SimpleAttributeSet) s1.copyAttributes();
+ harness.check(s1.equals(s2));
+ s1.addAttribute("X1", "Y1");
+ harness.check(!s1.equals(s2));
+
+ // copy a set with no resolve parent
+ s2 = (SimpleAttributeSet) s1.copyAttributes();
+ harness.check(s1.equals(s2));
+ s1.addAttribute("X2", "Y2");
+ harness.check(!s1.equals(s2));
+
+ // copy a set with a resolve parent
+ SimpleAttributeSet s3 = new SimpleAttributeSet();
+ s3.addAttribute("A1", "B1");
+ s1.setResolveParent(s3);
+ s2 = (SimpleAttributeSet) s1.copyAttributes();
+ harness.check(s1.equals(s2));
+ s3.addAttribute("A1", "BB");
+ harness.check(s1.equals(s2));
+ s1.addAttribute("Y1", "-");
+ harness.check(!s1.equals(s2));
+
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/equals.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/equals.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/equals.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/equals.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,55 @@
+/* equals.java -- some checks for the equals() method in the SimpleAttributeSet
+ 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the equals() field in the {@link SimpleAttributeSet}
+ * class.
+ */
+public class equals implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("equals()");
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ harness.check(s.equals(SimpleAttributeSet.EMPTY), true);
+ harness.check(SimpleAttributeSet.EMPTY.equals(s), true);
+ harness.check(s.equals(null), false);
+ harness.check(s.equals("XYZ"), false);
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttribute.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttribute.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttribute.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttribute.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,72 @@
+/* getAttribute.java -- Some checks for the getAttribute() method in the
+ SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+public class getAttribute implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("getAttribute()");
+
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ harness.check(s.getAttribute("X1"), null);
+ s.addAttribute("X1", "Y1");
+ harness.check(s.getAttribute("X1"), "Y1");
+
+ // add an attribute that exists in the resolve parent, same value
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ sParent.addAttribute("X2", "Y2");
+ s.setResolveParent(sParent);
+ harness.check(s.getAttribute("X2"), "Y2");
+
+ // this adds to s, not sParent
+ s.addAttribute("X2", "YY2");
+ harness.check(s.getAttribute("X2"), "YY2");
+
+ // try null attribute key
+ boolean pass = false;
+ try
+ {
+ s.getAttribute(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ }
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttributeCount.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttributeCount.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttributeCount.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttributeCount.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,63 @@
+/* getAttributeCount.java -- Some checks for the getAttributeCount() method in
+ the SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+public class getAttributeCount implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("getAttributeCount()");
+
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ harness.check(s.getAttributeCount(), 0);
+
+ s.addAttribute("X1", "Y1");
+ harness.check(s.getAttributeCount(), 1);
+
+ // add an attribute that exists in the resolve parent, same value
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ s.setResolveParent(sParent);
+ harness.check(s.getAttributeCount(), 2);
+
+ sParent.addAttribute("X2", "Y2");
+ harness.check(s.getAttributeCount(), 2);
+ sParent.addAttribute("X3", "Y3");
+ harness.check(s.getAttributeCount(), 2);
+
+ s.addAttribute("X2", "YY2");
+ harness.check(s.getAttributeCount(), 3);
+ }
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttributeNames.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttributeNames.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttributeNames.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/getAttributeNames.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,66 @@
+/* getAttributeNames.java -- Some checks for the getAttributeNames() method in
+ the SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Enumeration;
+
+import javax.swing.text.AttributeSet;
+import javax.swing.text.SimpleAttributeSet;
+
+public class getAttributeNames implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("getAttributeNames()");
+
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ Enumeration e = s.getAttributeNames();
+ harness.check(e.hasMoreElements(), false);
+
+ s.addAttribute("X1", "Y1");
+ e = s.getAttributeNames();
+ harness.check(e.hasMoreElements(), true);
+ harness.check(e.nextElement(), "X1");
+ harness.check(e.hasMoreElements(), false);
+
+ // add an attribute that exists in the resolve parent, same value
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ s.setResolveParent(sParent);
+ s.removeAttribute("X1");
+ e = s.getAttributeNames();
+ harness.check(e.hasMoreElements(), true);
+ harness.check(e.nextElement(), AttributeSet.ResolveAttribute);
+ harness.check(e.hasMoreElements(), false);
+ }
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/getResolveParent.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/getResolveParent.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/getResolveParent.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/getResolveParent.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,56 @@
+/* getResolveParent.java -- Some checks for the getResolveParent() method in
+ the SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.AttributeSet;
+import javax.swing.text.SimpleAttributeSet;
+
+public class getResolveParent implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("getResolveParent()");
+
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ harness.check(s.getResolveParent(), null);
+
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ s.setResolveParent(sParent);
+ harness.check(s.getResolveParent(), sParent);
+
+ s.removeAttribute(AttributeSet.ResolveAttribute);
+ harness.check(s.getResolveParent(), null);
+
+ }
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/isDefined.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/isDefined.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/isDefined.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/isDefined.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,71 @@
+/* isDefined.java -- Some checks for the isDefined() method in the
+ SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.AttributeSet;
+import javax.swing.text.SimpleAttributeSet;
+
+public class isDefined implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("isDefined()");
+
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ harness.check(s.isDefined("X1"), false);
+ s.addAttribute("X1", "Y1");
+ harness.check(s.isDefined("X1"), true);
+ s.removeAttribute("X1");
+ harness.check(s.isDefined("X1"), false);
+
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ sParent.addAttribute("X2", "Y2");
+ s.setResolveParent(sParent);
+ harness.check(s.isDefined("X2"), false);
+ harness.check(s.isDefined(AttributeSet.ResolveAttribute), true);
+
+ // try null attribute key
+ boolean pass = false;
+ try
+ {
+ s.isDefined(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ }
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/isEmpty.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/isEmpty.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/isEmpty.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/isEmpty.java 13 Jan 2006 14:50:54 -0000
@@ -0,0 +1,61 @@
+/* isEmpty.java -- Some checks for the isEmpty() method in the
+ SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+public class isEmpty implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("getAttributeCount()");
+
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ harness.check(s.isEmpty(), true);
+
+ s.addAttribute("X1", "Y1");
+ harness.check(s.isEmpty(), false);
+
+ s.removeAttribute("X1");
+ harness.check(s.isEmpty(), true);
+
+ // add an attribute that exists in the resolve parent, same value
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ s.setResolveParent(sParent);
+ harness.check(s.isEmpty(), false);
+
+ sParent.addAttribute("X2", "Y2");
+ harness.check(s.isEmpty(), false);
+ }
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/isEqual.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/isEqual.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/isEqual.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/isEqual.java 13 Jan 2006 14:50:55 -0000
@@ -0,0 +1,69 @@
+/* isEqual.java -- some checks for the isEqual() method in the
+ SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the isEqual() field in the {@link SimpleAttributeSet}
+ * class.
+ */
+public class isEqual implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("isEqual()");
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ harness.check(s.isEqual(SimpleAttributeSet.EMPTY), true);
+ harness.check(SimpleAttributeSet.EMPTY.isEqual(s), true);
+
+ SimpleAttributeSet s2 = new SimpleAttributeSet();
+ s2.addAttribute("XX", "YY");
+
+ harness.check(s.isEqual(s2), false);
+
+ boolean pass = false;
+ try
+ {
+ s.isEqual(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/removeAttribute.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/removeAttribute.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/removeAttribute.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/removeAttribute.java 13 Jan 2006 14:50:55 -0000
@@ -0,0 +1,81 @@
+/* removeAttribute.java -- Tests for the removeAttribute() method in the
+ SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the removeAttribute() method in the
+ * {@link SimpleAttributeSet} class.
+ */
+public class removeAttribute implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("removeAttribute()");
+
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ // remove an attribute that doesn't exist
+ s.removeAttribute("X1");
+ s.addAttribute("X1", "Y1");
+ harness.check(s.getAttribute("X1"), "Y1");
+ // remove another attribute that doesn't exist
+ s.removeAttribute("X2");
+ harness.check(s.getAttributeCount(), 1);
+ // remove an existing attribute
+ s.removeAttribute("X1");
+ harness.check(s.getAttribute("X1"), null);
+
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ sParent.addAttribute("XX", "YY");
+ s.setResolveParent(sParent);
+ harness.check(sParent.getAttributeCount(), 1);
+ s.removeAttribute("XX");
+ harness.check(sParent.getAttribute("XX"), "YY");
+
+ // try null attribute key
+ boolean pass = false;
+ try
+ {
+ s.removeAttribute(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/removeAttributes.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/removeAttributes.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/removeAttributes.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/removeAttributes.java 13 Jan 2006 14:50:55 -0000
@@ -0,0 +1,160 @@
+/* removeAttributes.java -- Tests for the removeAttributes() method in the
+ SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import javax.swing.text.AttributeSet;
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * Some checks for the removeAttributes() method in the
+ * {@link SimpleAttributeSet} class.
+ */
+public class removeAttributes implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ test1(harness);
+ test2(harness);
+ }
+
+ public void test1(TestHarness harness)
+ {
+ harness.checkPoint("(AttributeSet)");
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ s.addAttribute("A", "1");
+ s.addAttribute("B", "2");
+ s.addAttribute("C", "3");
+ s.addAttribute("D", "4");
+ s.addAttribute("E", "5");
+ s.addAttribute("F", "6");
+ harness.check(s.getAttributeCount(), 6);
+
+ SimpleAttributeSet ss = new SimpleAttributeSet();
+ ss.addAttribute("A", "1");
+ ss.addAttribute("C", "3");
+ ss.addAttribute("E", "5");
+
+ s.removeAttributes(ss);
+ harness.check(s.getAttributeCount(), 3);
+ harness.check(s.getAttribute("B"), "2");
+ harness.check(s.getAttribute("D"), "4");
+ harness.check(s.getAttribute("F"), "6");
+
+ SimpleAttributeSet sss = new SimpleAttributeSet();
+ ss.addAttribute("B", "XXX");
+ s.removeAttributes(sss);
+ harness.check(s.getAttributeCount(), 3);
+ harness.check(s.getAttribute("B"), "2");
+ harness.check(s.getAttribute("D"), "4");
+ harness.check(s.getAttribute("F"), "6");
+
+ // check for remove of the resolve parent
+ SimpleAttributeSet s2 = new SimpleAttributeSet();
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ s2.setResolveParent(sParent);
+ harness.check(s2.getResolveParent(), sParent);
+ SimpleAttributeSet s3 = new SimpleAttributeSet();
+ s3.setResolveParent(sParent);
+ s2.removeAttributes(s3);
+ harness.check(s2.getResolveParent(), null);
+
+ // try null
+ boolean pass = false;
+ try
+ {
+ s.removeAttributes((AttributeSet) null);
+ }
+ catch (NullPointerException ex)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+ public void test2(TestHarness harness)
+ {
+ harness.checkPoint("(Enumeration)");
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ s.addAttribute("A", "1");
+ s.addAttribute("B", "2");
+ s.addAttribute("C", "3");
+ s.addAttribute("D", "4");
+ s.addAttribute("E", "5");
+ s.addAttribute("F", "6");
+ harness.check(s.getAttributeCount(), 6);
+
+ Vector v = new Vector();
+ v.add("B");
+ v.add("D");
+ v.add("F");
+ Enumeration e = v.elements();
+ s.removeAttributes(e);
+ harness.check(s.getAttributeCount(), 3);
+ harness.check(s.getAttribute("A"), "1");
+ harness.check(s.getAttribute("C"), "3");
+ harness.check(s.getAttribute("E"), "5");
+
+ // try an enumeration with null in it
+ boolean pass = false;
+ try
+ {
+ v.clear();
+ v.add(null);
+ e = v.elements();
+ s.removeAttributes(e);
+ }
+ catch (NullPointerException ex)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try a null enumeration
+ pass = false;
+ try
+ {
+ s.removeAttributes((Enumeration) null);
+ }
+ catch (NullPointerException ex)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/javax/swing/text/SimpleAttributeSet/setResolveParent.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/SimpleAttributeSet/setResolveParent.java
diff -N gnu/testlet/javax/swing/text/SimpleAttributeSet/setResolveParent.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/SimpleAttributeSet/setResolveParent.java 13 Jan 2006 14:50:55 -0000
@@ -0,0 +1,62 @@
+/* setResolveParent.java -- Some checks for the setResolveParent() method in
+ the SimpleAttributeSet 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.text.SimpleAttributeSet;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.text.SimpleAttributeSet;
+
+public class setResolveParent implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("setResolveParent()");
+
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ harness.check(s.getResolveParent(), null);
+
+ SimpleAttributeSet sParent = new SimpleAttributeSet();
+ s.setResolveParent(sParent);
+ harness.check(s.getResolveParent(), sParent);
+
+ boolean pass = false;
+ try
+ {
+ s.setResolveParent(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+}
\ No newline at end of file