* FYI: New JInternalFrame tests
@ 2006-03-15 14:46 Roman Kennke
0 siblings, 0 replies; only message in thread
From: Roman Kennke @ 2006-03-15 14:46 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 863 bytes --]
I added a couple of tests to check if the boolean properties in
JInternalFrame must be bound or not. This shows some mistakes in
Classpath's impl.
2006-03-15 Roman Kennke <kennke@aicas.com>
* gnu/testlet/javax/swing/JInternalFrame/setSelected.java:
Added test for bound property.
* gnu/testlet/javax/swing/JInternalFrame/setResizable.java:
Added test for bound property.
* gnu/testlet/javax/swing/JInternalFrame/setMaximizable.java:
Added test for bound property.
* gnu/testlet/javax/swing/JInternalFrame/setIconifiable.java:
Added test for bound property.
* gnu/testlet/javax/swing/JInternalFrame/setClosed.java:
Added test for bound property.
* gnu/testlet/javax/swing/JInternalFrame/setClosable.java:
Added test for bound property.
/Roman
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch.diff --]
[-- Type: text/x-patch; name="patch.diff", Size: 15308 bytes --]
Index: gnu/testlet/javax/swing/JInternalFrame/setClosable.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/setClosable.java
diff -N gnu/testlet/javax/swing/JInternalFrame/setClosable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/setClosable.java 15 Mar 2006 14:27:34 -0000
@@ -0,0 +1,81 @@
+/* setClosable.java -- Checks the setClosable method
+ Copyright (C) 2006 Roman Kennke (kennke@aicas.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.JInternalFrame;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class setClosable implements Testlet
+{
+
+ /**
+ * Catches property changes and stores the property name.
+ */
+ class TestPropertyChangeHandler
+ implements PropertyChangeListener
+ {
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ propertyChanged = e.getPropertyName();
+ }
+
+ }
+
+ /**
+ * Stores the name of the last changed property.
+ */
+ String propertyChanged;
+
+ /**
+ * The entry point in this test.
+ *
+ * @param harness the test harness to use
+ */
+ public void test(TestHarness harness)
+ {
+ testBoundProperty(harness);
+ }
+
+ /**
+ * Tests if this is a bound property.
+ *
+ * @param h the test harness to use
+ */
+ private void testBoundProperty(TestHarness h)
+ {
+ h.checkPoint("testBoundProperty");
+ JInternalFrame t = new JInternalFrame();
+ t.addPropertyChangeListener(new TestPropertyChangeHandler());
+ t.setClosable(false);
+ propertyChanged = null;
+ t.setClosable(true);
+ h.check(propertyChanged, "closable");
+ }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/setClosed.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/setClosed.java
diff -N gnu/testlet/javax/swing/JInternalFrame/setClosed.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/setClosed.java 15 Mar 2006 14:27:34 -0000
@@ -0,0 +1,89 @@
+/* setClosed.java -- Checks the setClosed method
+ Copyright (C) 2006 Roman Kennke (kennke@aicas.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.JInternalFrame;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyVetoException;
+
+import javax.swing.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class setClosed implements Testlet
+{
+
+ /**
+ * Catches property changes and stores the property name.
+ */
+ class TestPropertyChangeHandler
+ implements PropertyChangeListener
+ {
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ propertyChanged = e.getPropertyName();
+ }
+
+ }
+
+ /**
+ * Stores the name of the last changed property.
+ */
+ String propertyChanged;
+
+ /**
+ * The entry point in this test.
+ *
+ * @param harness the test harness to use
+ */
+ public void test(TestHarness harness)
+ {
+ testBoundProperty(harness);
+ }
+
+ /**
+ * Tests if this is a bound property.
+ *
+ * @param h the test harness to use
+ */
+ private void testBoundProperty(TestHarness h)
+ {
+ h.checkPoint("testBoundProperty");
+ JInternalFrame t = new JInternalFrame();
+ t.addPropertyChangeListener(new TestPropertyChangeHandler());
+ try
+ {
+ t.setClosed(false);
+ propertyChanged = null;
+ t.setClosed(true);
+ h.check(propertyChanged, "closed");
+ }
+ catch (PropertyVetoException ex)
+ {
+ h.fail(ex.getMessage());
+ }
+ }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/setIconifiable.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/setIconifiable.java
diff -N gnu/testlet/javax/swing/JInternalFrame/setIconifiable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/setIconifiable.java 15 Mar 2006 14:27:34 -0000
@@ -0,0 +1,81 @@
+/* setIconifiable.java -- Checks the setIconifiable method
+ Copyright (C) 2006 Roman Kennke (kennke@aicas.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.JInternalFrame;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class setIconifiable implements Testlet
+{
+
+ /**
+ * Catches property changes and stores the property name.
+ */
+ class TestPropertyChangeHandler
+ implements PropertyChangeListener
+ {
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ propertyChanged = e.getPropertyName();
+ }
+
+ }
+
+ /**
+ * Stores the name of the last changed property.
+ */
+ String propertyChanged;
+
+ /**
+ * The entry point in this test.
+ *
+ * @param harness the test harness to use
+ */
+ public void test(TestHarness harness)
+ {
+ testBoundProperty(harness);
+ }
+
+ /**
+ * Tests if this is a bound property.
+ *
+ * @param h the test harness to use
+ */
+ private void testBoundProperty(TestHarness h)
+ {
+ h.checkPoint("testBoundProperty");
+ JInternalFrame t = new JInternalFrame();
+ t.addPropertyChangeListener(new TestPropertyChangeHandler());
+ t.setIconifiable(false);
+ propertyChanged = null;
+ t.setIconifiable(true);
+ h.check(propertyChanged, "iconable");
+ }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/setMaximizable.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/setMaximizable.java
diff -N gnu/testlet/javax/swing/JInternalFrame/setMaximizable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/setMaximizable.java 15 Mar 2006 14:27:34 -0000
@@ -0,0 +1,81 @@
+/* setMaximizable.java -- Checks the setMaximizable method
+ Copyright (C) 2006 Roman Kennke (kennke@aicas.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.JInternalFrame;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class setMaximizable implements Testlet
+{
+
+ /**
+ * Catches property changes and stores the property name.
+ */
+ class TestPropertyChangeHandler
+ implements PropertyChangeListener
+ {
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ propertyChanged = e.getPropertyName();
+ }
+
+ }
+
+ /**
+ * Stores the name of the last changed property.
+ */
+ String propertyChanged;
+
+ /**
+ * The entry point in this test.
+ *
+ * @param harness the test harness to use
+ */
+ public void test(TestHarness harness)
+ {
+ testBoundProperty(harness);
+ }
+
+ /**
+ * Tests if this is a bound property.
+ *
+ * @param h the test harness to use
+ */
+ private void testBoundProperty(TestHarness h)
+ {
+ h.checkPoint("testBoundProperty");
+ JInternalFrame t = new JInternalFrame();
+ t.addPropertyChangeListener(new TestPropertyChangeHandler());
+ t.setMaximizable(false);
+ propertyChanged = null;
+ t.setMaximizable(true);
+ h.check(propertyChanged, "maximizable");
+ }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/setResizable.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/setResizable.java
diff -N gnu/testlet/javax/swing/JInternalFrame/setResizable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/setResizable.java 15 Mar 2006 14:27:34 -0000
@@ -0,0 +1,81 @@
+/* setResizable.java -- Checks the setResizable method
+ Copyright (C) 2006 Roman Kennke (kennke@aicas.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.JInternalFrame;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class setResizable implements Testlet
+{
+
+ /**
+ * Catches property changes and stores the property name.
+ */
+ class TestPropertyChangeHandler
+ implements PropertyChangeListener
+ {
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ propertyChanged = e.getPropertyName();
+ }
+
+ }
+
+ /**
+ * Stores the name of the last changed property.
+ */
+ String propertyChanged;
+
+ /**
+ * The entry point in this test.
+ *
+ * @param harness the test harness to use
+ */
+ public void test(TestHarness harness)
+ {
+ testBoundProperty(harness);
+ }
+
+ /**
+ * Tests if this is a bound property.
+ *
+ * @param h the test harness to use
+ */
+ private void testBoundProperty(TestHarness h)
+ {
+ h.checkPoint("testBoundProperty");
+ JInternalFrame t = new JInternalFrame();
+ t.addPropertyChangeListener(new TestPropertyChangeHandler());
+ t.setResizable(false);
+ propertyChanged = null;
+ t.setResizable(true);
+ h.check(propertyChanged, "resizable");
+ }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/setSelected.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/JInternalFrame/setSelected.java,v
retrieving revision 1.1
diff -u -r1.1 setSelected.java
--- gnu/testlet/javax/swing/JInternalFrame/setSelected.java 13 Mar 2006 16:08:32 -0000 1.1
+++ gnu/testlet/javax/swing/JInternalFrame/setSelected.java 15 Mar 2006 14:27:34 -0000
@@ -23,6 +23,8 @@
package gnu.testlet.javax.swing.JInternalFrame;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
import javax.swing.JFrame;
@@ -30,6 +32,7 @@
import gnu.testlet.TestHarness;
import gnu.testlet.Testlet;
+import gnu.testlet.javax.swing.JInternalFrame.setResizable.TestPropertyChangeHandler;
/**
* Tests the functionality of the setSelected() method in JInternalFrame.
@@ -54,6 +57,25 @@
}
/**
+ * Catches property changes and stores the property name.
+ */
+ class TestPropertyChangeHandler
+ implements PropertyChangeListener
+ {
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ propertyChanged = e.getPropertyName();
+ }
+
+ }
+
+ /**
+ * Stores the name of the last changed property.
+ */
+ String propertyChanged;
+
+ /**
* The entry point into this test.
*
* @param harness the test harness to use
@@ -61,6 +83,7 @@
public void test(TestHarness harness)
{
testRepaint(harness);
+ testBoundProperty(harness);
}
/**
@@ -121,4 +144,34 @@
}
}
+
+ /**
+ * Tests if this is a bound property.
+ *
+ * @param h the test harness to use
+ */
+ private void testBoundProperty(TestHarness h)
+ {
+ h.checkPoint("testBoundProperty");
+ JInternalFrame t = new JInternalFrame();
+ t.addPropertyChangeListener(new TestPropertyChangeHandler());
+ try
+ {
+
+ JFrame fr = new JFrame();
+ fr.getContentPane().add(t);
+ fr.setSize(100, 100);
+ fr.setVisible(true);
+ t.setVisible(true);
+
+ t.setSelected(false);
+ propertyChanged = null;
+ t.setSelected(true);
+ h.check(propertyChanged, "selected");
+ }
+ catch (PropertyVetoException ex)
+ {
+ h.fail(ex.getMessage());
+ }
+ }
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-03-15 14:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-15 14:46 FYI: New JInternalFrame tests Roman Kennke
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).