This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: SimpleBeanInfo tests
- From: David Gilbert <david dot gilbert at object-refinery dot com>
- To: mauve-patches <mauve-patches at sources dot redhat dot com>
- Date: Thu, 09 Nov 2006 12:30:39 +0000
- Subject: FYI: SimpleBeanInfo tests
This patch (committed) adds tests for the methods in SimpleBeanInfo:
2006-11-09 David Gilbert <david.gilbert@object-refinery.com>
* gnu/testlet/java/beans/SimpleBeanInfo/getAdditionalBeanInfo.java:
New file,
* gnu/testlet/java/beans/SimpleBeanInfo/getBeanDescriptor.java:
New file,
* gnu/testlet/java/beans/SimpleBeanInfo/getDefaultEventIndex.java:
New file,
* gnu/testlet/java/beans/SimpleBeanInfo/getDefaultPropertyIndex.java:
New file,
* gnu/testlet/java/beans/SimpleBeanInfo/getEventSetDescriptors.java:
New file,
* gnu/testlet/java/beans/SimpleBeanInfo/getIcon.java: New file,
* gnu/testlet/java/beans/SimpleBeanInfo/loadImage.java: New file,
* gnu/testlet/java/beans/SimpleBeanInfo/MySimpleBeanInfo.java: New file,
* gnu/testlet/java/beans/SimpleBeanInfo/testImage1.gif: New file.
All pass with GNU Classpath, except for the loadImage() test. I have a
patch to fix that.
Regards,
Dave
Index: gnu/testlet/java/beans/SimpleBeanInfo/MySimpleBeanInfo.java
===================================================================
RCS file: gnu/testlet/java/beans/SimpleBeanInfo/MySimpleBeanInfo.java
diff -N gnu/testlet/java/beans/SimpleBeanInfo/MySimpleBeanInfo.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/beans/SimpleBeanInfo/MySimpleBeanInfo.java 9 Nov 2006 12:23:37 -0000
@@ -0,0 +1,36 @@
+/* MySimpleBeanInfo.java -- support class for testing.
+ 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: not-a-test
+
+package gnu.testlet.java.beans.SimpleBeanInfo;
+
+import java.beans.SimpleBeanInfo;
+
+public class MySimpleBeanInfo extends SimpleBeanInfo
+{
+
+ public MySimpleBeanInfo()
+ {
+ super();
+ }
+
+}
Index: gnu/testlet/java/beans/SimpleBeanInfo/getAdditionalBeanInfo.java
===================================================================
RCS file: gnu/testlet/java/beans/SimpleBeanInfo/getAdditionalBeanInfo.java
diff -N gnu/testlet/java/beans/SimpleBeanInfo/getAdditionalBeanInfo.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/beans/SimpleBeanInfo/getAdditionalBeanInfo.java 9 Nov 2006 12:23:37 -0000
@@ -0,0 +1,39 @@
+/* getAdditionalBeanInfo.java -- some checks for the getAdditionalBeanInfo()
+ method in the SimpleBeanInfo 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.beans.SimpleBeanInfo;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.SimpleBeanInfo;
+
+public class getAdditionalBeanInfo implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ SimpleBeanInfo i = new SimpleBeanInfo();
+ harness.check(i.getAdditionalBeanInfo(), null);
+ }
+}
Index: gnu/testlet/java/beans/SimpleBeanInfo/getBeanDescriptor.java
===================================================================
RCS file: gnu/testlet/java/beans/SimpleBeanInfo/getBeanDescriptor.java
diff -N gnu/testlet/java/beans/SimpleBeanInfo/getBeanDescriptor.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/beans/SimpleBeanInfo/getBeanDescriptor.java 9 Nov 2006 12:23:37 -0000
@@ -0,0 +1,39 @@
+/* getBeanDescriptor.java -- some checks for the getBeanDescriptor() method
+ in the SimpleBeanInfo 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.beans.SimpleBeanInfo;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.SimpleBeanInfo;
+
+public class getBeanDescriptor implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ SimpleBeanInfo i = new SimpleBeanInfo();
+ harness.check(i.getBeanDescriptor(), null);
+ }
+}
Index: gnu/testlet/java/beans/SimpleBeanInfo/getDefaultEventIndex.java
===================================================================
RCS file: gnu/testlet/java/beans/SimpleBeanInfo/getDefaultEventIndex.java
diff -N gnu/testlet/java/beans/SimpleBeanInfo/getDefaultEventIndex.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/beans/SimpleBeanInfo/getDefaultEventIndex.java 9 Nov 2006 12:23:37 -0000
@@ -0,0 +1,39 @@
+/* getDefaultEventIndex.java -- some checks for the getDefaultEventIndex()
+ method in the SimpleBeanInfo 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.beans.SimpleBeanInfo;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.SimpleBeanInfo;
+
+public class getDefaultEventIndex implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ SimpleBeanInfo i = new SimpleBeanInfo();
+ harness.check(i.getDefaultEventIndex(), -1);
+ }
+}
Index: gnu/testlet/java/beans/SimpleBeanInfo/getDefaultPropertyIndex.java
===================================================================
RCS file: gnu/testlet/java/beans/SimpleBeanInfo/getDefaultPropertyIndex.java
diff -N gnu/testlet/java/beans/SimpleBeanInfo/getDefaultPropertyIndex.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/beans/SimpleBeanInfo/getDefaultPropertyIndex.java 9 Nov 2006 12:23:37 -0000
@@ -0,0 +1,39 @@
+/* getDefaultPropertyIndex.java -- some checks for the getDefaultPropertyIndex()
+ method in the SimpleBeanInfo 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.beans.SimpleBeanInfo;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.SimpleBeanInfo;
+
+public class getDefaultPropertyIndex implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ SimpleBeanInfo i = new SimpleBeanInfo();
+ harness.check(i.getDefaultPropertyIndex(), -1);
+ }
+}
Index: gnu/testlet/java/beans/SimpleBeanInfo/getEventSetDescriptors.java
===================================================================
RCS file: gnu/testlet/java/beans/SimpleBeanInfo/getEventSetDescriptors.java
diff -N gnu/testlet/java/beans/SimpleBeanInfo/getEventSetDescriptors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/beans/SimpleBeanInfo/getEventSetDescriptors.java 9 Nov 2006 12:23:37 -0000
@@ -0,0 +1,39 @@
+/* getEventSetDescriptors.java -- some checks for the getEventSetDescriptors()
+ method in the SimpleBeanInfo 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.java.beans.SimpleBeanInfo;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.SimpleBeanInfo;
+
+public class getEventSetDescriptors implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ SimpleBeanInfo i = new SimpleBeanInfo();
+ harness.check(i.getEventSetDescriptors(), null);
+ }
+}
Index: gnu/testlet/java/beans/SimpleBeanInfo/getIcon.java
===================================================================
RCS file: gnu/testlet/java/beans/SimpleBeanInfo/getIcon.java
diff -N gnu/testlet/java/beans/SimpleBeanInfo/getIcon.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/beans/SimpleBeanInfo/getIcon.java 9 Nov 2006 12:23:37 -0000
@@ -0,0 +1,43 @@
+/* getIcon.java -- some checks for the getIcon() method in the SimpleBeanInfo
+ 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.beans.SimpleBeanInfo;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.SimpleBeanInfo;
+
+public class getIcon implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ SimpleBeanInfo i = new SimpleBeanInfo();
+ harness.check(i.getIcon(SimpleBeanInfo.ICON_COLOR_16x16), null);
+ harness.check(i.getIcon(SimpleBeanInfo.ICON_COLOR_32x32), null);
+ harness.check(i.getIcon(SimpleBeanInfo.ICON_MONO_16x16), null);
+ harness.check(i.getIcon(SimpleBeanInfo.ICON_MONO_32x32), null);
+ harness.check(i.getIcon(-99), null);
+ }
+}
Index: gnu/testlet/java/beans/SimpleBeanInfo/loadImage.java
===================================================================
RCS file: gnu/testlet/java/beans/SimpleBeanInfo/loadImage.java
diff -N gnu/testlet/java/beans/SimpleBeanInfo/loadImage.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/beans/SimpleBeanInfo/loadImage.java 9 Nov 2006 12:23:37 -0000
@@ -0,0 +1,62 @@
+/* loadImage.java -- some checks for the loadImage() method in the
+ SimpleBeanInfo 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.java.beans.SimpleBeanInfo;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Image;
+import java.awt.MediaTracker;
+import java.awt.Panel;
+import java.awt.image.ImageObserver;
+
+public class loadImage implements Testlet, ImageObserver
+{
+ public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+public void test(TestHarness harness)
+ {
+ MySimpleBeanInfo i = new MySimpleBeanInfo();
+ Image image = i.loadImage("testImage1.gif");
+ MediaTracker mt = new MediaTracker(new Panel());
+ mt.addImage(image, 0);
+ try
+ {
+ mt.waitForAll();
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ harness.check(!mt.isErrorAny());
+ harness.check(image.getWidth(null), 2);
+ harness.check(image.getHeight(null), 2);
+ harness.check(i.loadImage("someImageThatDoesNotExist.png"), null);
+ harness.check(i.loadImage(null), null);
+ }
+}
Index: gnu/testlet/java/beans/SimpleBeanInfo/testImage1.gif
===================================================================
RCS file: gnu/testlet/java/beans/SimpleBeanInfo/testImage1.gif
diff -N gnu/testlet/java/beans/SimpleBeanInfo/testImage1.gif
Binary files /dev/null and testImage1.gif differ