This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
Patch for Windows users
- From: Fabien DUMINY <fabien dot duminy at laposte dot net>
- To: mauve-patches at sources dot redhat dot com
- Date: Wed, 14 Sep 2005 20:27:15 +0200
- Subject: Patch for Windows users
- Reply-to: fduminy at users dot sourceforge dot net
Hi all,
here is a patch for allowing Windows user (like me) to solve the case
problem with filenames.
Color has been renamed to ColorClass, Font to FontClass and Event to
EventClass.
Fabien.
Index: ChangeLog
===================================================================
RCS file: /cvs/mauve/mauve/ChangeLog,v
retrieving revision 1.1086
diff -u -r1.1086 ChangeLog
--- ChangeLog 13 Sep 2005 19:54:43 -0000 1.1086
+++ ChangeLog 14 Sep 2005 18:12:58 -0000
@@ -1,3 +1,8 @@
+2005-09-14 Fabien DUMINY <fduminy@jnode.org>
+ * for Windows users: renamed gnu/testlet/java/awt/Color to gnu/testlet/java/awt/ColorClass
+ * for Windows users: renamed gnu/testlet/java/awt/Event to gnu/testlet/java/awt/EventClass
+ * for Windows users: renamed gnu/testlet/java/awt/Font to gnu/testlet/java/awt/FontClass
+
2005-09-13 David Gilbert <david.gilbert@object-refinery.com>
* gnu/testlet/javax/swing/plaf/basic/BasicCheckBoxUI/getPropertyPrefix.java: new test,
Index: gnu/testlet/java/awt/Color/constants.java
===================================================================
RCS file: gnu/testlet/java/awt/Color/constants.java
diff -N gnu/testlet/java/awt/Color/constants.java
--- gnu/testlet/java/awt/Color/constants.java 16 May 2005 21:47:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,57 +0,0 @@
-// Tags: JDK1.2
-
-// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA. */
-
-package gnu.testlet.java.awt.Color;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Color;
-
-/**
- * Some checks for the constants defined by the {@link Color} class.
- */
-public class constants 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.check(Color.black.equals(new Color(0, 0, 0)));
- harness.check(Color.blue.equals(new Color(0, 0, 255)));
- harness.check(Color.cyan.equals(new Color(0, 255, 255)));
- harness.check(Color.darkGray.equals(new Color(64, 64, 64)));
- harness.check(Color.gray.equals(new Color(128, 128, 128)));
- harness.check(Color.green.equals(new Color(0, 255, 0)));
- harness.check(Color.lightGray.equals(new Color(192, 192, 192)));
- harness.check(Color.magenta.equals(new Color(255, 0, 255)));
- harness.check(Color.orange.equals(new Color(255, 200, 0)));
- harness.check(Color.pink.equals(new Color(255, 175, 175)));
- harness.check(Color.red.equals(new Color(255, 0, 0)));
- harness.check(Color.white.equals(new Color(255, 255, 255)));
- harness.check(Color.yellow.equals(new Color(255, 255, 0)));
- }
-
-}
Index: gnu/testlet/java/awt/Color/constructors.java
===================================================================
RCS file: gnu/testlet/java/awt/Color/constructors.java
diff -N gnu/testlet/java/awt/Color/constructors.java
--- gnu/testlet/java/awt/Color/constructors.java 16 May 2005 21:47:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,480 +0,0 @@
-// Tags: JDK1.2
-
-// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA. */
-
-package gnu.testlet.java.awt.Color;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Color;
-import java.awt.color.ColorSpace;
-
-/**
- * Some checks for the constructors in the {@link Color} 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);
- testConstructor3(harness);
- testConstructor4(harness);
- testConstructor5(harness);
- testConstructor6(harness);
- testConstructor7(harness);
- }
-
- private void testConstructor1(TestHarness harness)
- {
- harness.checkPoint("(ColorSpace, float[], float)");
- Color c = new Color(ColorSpace.getInstance(ColorSpace.CS_sRGB),
- new float[] { 0.2f, 0.4f, 0.6f}, 0.8f);
- harness.check(c.getRed(), 51);
- harness.check(c.getGreen(), 102);
- harness.check(c.getBlue(), 153);
- harness.check(c.getAlpha(), 204);
-
- // try null space
- boolean pass = false;
- try
- {
- c = new Color(null, new float[] { 0.2f, 0.4f, 0.6f}, 0.8f);
- }
- catch (NullPointerException e)
- {
- pass = true;
- }
- harness.check(pass);
- }
-
- private void testConstructor2(TestHarness harness)
- {
- harness.checkPoint("(float, float, float)");
- Color c = new Color(0.2f, 0.4f, 0.6f);
- harness.check(c.getRed(), 51);
- harness.check(c.getGreen(), 102);
- harness.check(c.getBlue(), 153);
- harness.check(c.getAlpha(), 255);
-
- // negative red
- boolean pass = false;
- try
- {
- c = new Color(-0.2f, 0.4f, 0.6f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // negative green
- pass = false;
- try
- {
- c = new Color(0.2f, -0.4f, 0.6f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // negative blue
- pass = false;
- try
- {
- c = new Color(0.2f, 0.4f, -0.6f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // red > 1.0
- pass = false;
- try
- {
- c = new Color(1.2f, 0.4f, 0.6f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // green > 1.0
- pass = false;
- try
- {
- c = new Color(0.2f, 1.4f, 0.6f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // blue > 1.0
- pass = false;
- try
- {
- c = new Color(0.2f, 0.4f, 1.6f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- }
-
- private void testConstructor3(TestHarness harness)
- {
- harness.checkPoint("(float, float, float, float)");
- Color c = new Color(0.2f, 0.4f, 0.6f, 0.8f);
- harness.check(c.getRed(), 51);
- harness.check(c.getGreen(), 102);
- harness.check(c.getBlue(), 153);
- harness.check(c.getAlpha(), 204);
-
- // negative red
- boolean pass = false;
- try
- {
- c = new Color(-0.2f, 0.4f, 0.6f, 0.8f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // negative green
- pass = false;
- try
- {
- c = new Color(0.2f, -0.4f, 0.6f, 0.8f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // negative blue
- pass = false;
- try
- {
- c = new Color(0.2f, 0.4f, -0.6f, 0.8f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // negative alpha
- pass = false;
- try
- {
- c = new Color(0.2f, 0.4f, 0.6f, -0.8f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // red > 1.0
- pass = false;
- try
- {
- c = new Color(1.2f, 0.4f, 0.6f, 0.8f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // green > 1.0
- pass = false;
- try
- {
- c = new Color(0.2f, 1.4f, 0.6f, 0.8f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // blue > 1.0
- pass = false;
- try
- {
- c = new Color(0.2f, 0.4f, 1.6f, 0.8f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // alpha > 1.0
- pass = false;
- try
- {
- c = new Color(0.2f, 0.4f, 0.6f, 1.8f);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- }
-
- private void testConstructor4(TestHarness harness)
- {
- harness.checkPoint("(int)");
- Color c = new Color(0x12345678);
- harness.check(c.getRed(), 0x34);
- harness.check(c.getGreen(), 0x56);
- harness.check(c.getBlue(), 0x78);
- harness.check(c.getAlpha(), 0xFF);
- }
-
- private void testConstructor5(TestHarness harness)
- {
- harness.checkPoint("(int, boolean)");
- Color c = new Color(0x12345678, false);
- harness.check(c.getRed(), 0x34);
- harness.check(c.getGreen(), 0x56);
- harness.check(c.getBlue(), 0x78);
- harness.check(c.getAlpha(), 0xFF);
-
- c = new Color(0x12345678, true);
- harness.check(c.getRed(), 0x34);
- harness.check(c.getGreen(), 0x56);
- harness.check(c.getBlue(), 0x78);
- harness.check(c.getAlpha(), 0x12);
- }
-
- private void testConstructor6(TestHarness harness)
- {
- harness.checkPoint("(int, int, int)");
- Color c = new Color(12, 34, 56);
- harness.check(c.getRed(), 12);
- harness.check(c.getGreen(), 34);
- harness.check(c.getBlue(), 56);
- harness.check(c.getAlpha(), 255);
-
- // negative red
- boolean pass = false;
- try
- {
- c = new Color(-12, 34, 56);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // negative green
- pass = false;
- try
- {
- c = new Color(12, -34, 56);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // negative blue
- pass = false;
- try
- {
- c = new Color(12, 34, -56);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // red > 1.0
- pass = false;
- try
- {
- c = new Color(512, 34, 56);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // green > 1.0
- pass = false;
- try
- {
- c = new Color(12, 534, 56);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // blue > 1.0
- pass = false;
- try
- {
- c = new Color(12, 34, 556);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
- }
-
- private void testConstructor7(TestHarness harness)
- {
- harness.checkPoint("(int, int, int, int)");
- Color c = new Color(12, 34, 56, 78);
- harness.check(c.getRed(), 12);
- harness.check(c.getGreen(), 34);
- harness.check(c.getBlue(), 56);
- harness.check(c.getAlpha(), 78);
-
- // negative red
- boolean pass = false;
- try
- {
- c = new Color(-12, 34, 56, 78);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // negative green
- pass = false;
- try
- {
- c = new Color(12, -34, 56, 78);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // negative blue
- pass = false;
- try
- {
- c = new Color(12, 34, -56, 78);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // negative alpha
- pass = false;
- try
- {
- c = new Color(12, 34, 56, -78);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // red > 1.0
- pass = false;
- try
- {
- c = new Color(512, 34, 56, 78);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // green > 1.0
- pass = false;
- try
- {
- c = new Color(12, 534, 56, 78);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // blue > 1.0
- pass = false;
- try
- {
- c = new Color(12, 34, 556, 78);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // alpha > 1.0
- pass = false;
- try
- {
- c = new Color(12, 34, 56, 578);
- }
- catch (IllegalArgumentException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- }
-
-}
Index: gnu/testlet/java/awt/Color/decode.java
===================================================================
RCS file: gnu/testlet/java/awt/Color/decode.java
diff -N gnu/testlet/java/awt/Color/decode.java
--- gnu/testlet/java/awt/Color/decode.java 16 May 2005 21:47:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,73 +0,0 @@
-// Tags: JDK1.1
-
-// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA. */
-
-package gnu.testlet.java.awt.Color;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Color;
-
-/**
- * Some checks for the decode() method in the {@link Color} class.
- */
-public class decode implements Testlet
-{
-
- /**
- * Runs the test using the specified harness.
- *
- * @param harness the test harness (<code>null</code> not permitted).
- */
- public void test(TestHarness harness)
- {
- Color c = Color.decode("0x010203");
- harness.check(c.getRed(), 1);
- harness.check(c.getGreen(), 2);
- harness.check(c.getBlue(), 3);
-
- // try a null argument - see bug parade 6211249
- boolean pass = false;
- try
- {
- Color.decode(null);
- }
- catch (NullPointerException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- // try a non-numeric string
- pass = false;
- try
- {
- Color.decode("XYZ");
- }
- catch (NumberFormatException e)
- {
- pass = true;
- }
- harness.check(pass);
-
- }
-
-}
Index: gnu/testlet/java/awt/Color/equals.java
===================================================================
RCS file: gnu/testlet/java/awt/Color/equals.java
diff -N gnu/testlet/java/awt/Color/equals.java
--- gnu/testlet/java/awt/Color/equals.java 16 May 2005 21:47:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,80 +0,0 @@
-// Tags: JDK1.2
-
-// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA. */
-
-package gnu.testlet.java.awt.Color;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Color;
-
-/**
- * Checks that the equals() method in the {@link Color} class works
- * correctly.
- */
-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)
- {
- Color c1 = new Color(1, 2, 3);
- Color c2 = new Color(1, 2, 3);
- harness.check(c1.equals(c2));
- harness.check(c2.equals(c1));
-
- c1 = new Color(1, 2, 3, 4);
- harness.check(!c1.equals(c2));
- c2 = new Color(1, 2, 3, 4);
- harness.check(c1.equals(c2));
-
- c1 = new Color(5, 2, 3, 4);
- harness.check(!c1.equals(c2));
- c2 = new Color(5, 2, 3, 4);
- harness.check(c1.equals(c2));
-
- c1 = new Color(5, 6, 3, 4);
- harness.check(!c1.equals(c2));
- c2 = new Color(5, 6, 3, 4);
- harness.check(c1.equals(c2));
-
- c1 = new Color(5, 6, 7, 4);
- harness.check(!c1.equals(c2));
- c2 = new Color(5, 6, 7, 4);
- harness.check(c1.equals(c2));
-
- c1 = new Color(5, 6, 7, 8);
- harness.check(!c1.equals(c2));
- c2 = new Color(5, 6, 7, 8);
- harness.check(c1.equals(c2));
-
- // check null argument
- harness.check(!c1.equals(null));
-
- // check non-Color argument
- harness.check(!c1.equals("XYZ"));
- }
-
-}
Index: gnu/testlet/java/awt/Color/getBlue.java
===================================================================
RCS file: gnu/testlet/java/awt/Color/getBlue.java
diff -N gnu/testlet/java/awt/Color/getBlue.java
--- gnu/testlet/java/awt/Color/getBlue.java 16 May 2005 21:47:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-// Tags: JDK1.1
-
-// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA. */
-
-package gnu.testlet.java.awt.Color;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Color;
-
-/**
- * Some checks for the getBlue() method in the {@link Color} class.
- */
-public class getBlue implements Testlet
-{
-
- /**
- * Runs the test using the specified harness.
- *
- * @param harness the test harness (<code>null</code> not permitted).
- */
- public void test(TestHarness harness)
- {
- Color c = new Color(1, 2, 3);
- harness.check(c.getBlue(), 3);
-
- c = new Color(243, 244, 245);
- harness.check(c.getBlue(), 245);
- }
-
-}
Index: gnu/testlet/java/awt/Color/getGreen.java
===================================================================
RCS file: gnu/testlet/java/awt/Color/getGreen.java
diff -N gnu/testlet/java/awt/Color/getGreen.java
--- gnu/testlet/java/awt/Color/getGreen.java 16 May 2005 21:47:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-// Tags: JDK1.1
-
-// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA. */
-
-package gnu.testlet.java.awt.Color;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Color;
-
-/**
- * Some checks for the getGreen() method in the {@link Color} class.
- */
-public class getGreen implements Testlet
-{
-
- /**
- * Runs the test using the specified harness.
- *
- * @param harness the test harness (<code>null</code> not permitted).
- */
- public void test(TestHarness harness)
- {
- Color c = new Color(1, 2, 3);
- harness.check(c.getGreen(), 2);
-
- c = new Color(243, 244, 245);
- harness.check(c.getGreen(), 244);
- }
-
-}
Index: gnu/testlet/java/awt/Color/getRed.java
===================================================================
RCS file: gnu/testlet/java/awt/Color/getRed.java
diff -N gnu/testlet/java/awt/Color/getRed.java
--- gnu/testlet/java/awt/Color/getRed.java 16 May 2005 21:47:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-// Tags: JDK1.1
-
-// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA. */
-
-package gnu.testlet.java.awt.Color;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Color;
-
-/**
- * Some checks for the getRed() method in the {@link Color} class.
- */
-public class getRed implements Testlet
-{
-
- /**
- * Runs the test using the specified harness.
- *
- * @param harness the test harness (<code>null</code> not permitted).
- */
- public void test(TestHarness harness)
- {
- Color c = new Color(1, 2, 3);
- harness.check(c.getRed(), 1);
-
- c = new Color(243, 244, 245);
- harness.check(c.getRed(), 243);
- }
-
-}
Index: gnu/testlet/java/awt/Color/hashCode.java
===================================================================
RCS file: gnu/testlet/java/awt/Color/hashCode.java
diff -N gnu/testlet/java/awt/Color/hashCode.java
--- gnu/testlet/java/awt/Color/hashCode.java 16 May 2005 21:47:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,50 +0,0 @@
-// Tags: JDK1.1
-
-// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA. */
-
-package gnu.testlet.java.awt.Color;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Color;
-
-/**
- * Some checks for the hashCode() method in the {@link Color} class works.
- */
-public class hashCode implements Testlet
-{
-
- /**
- * Runs the test using the specified harness.
- *
- * @param harness the test harness (<code>null</code> not permitted).
- */
- public void test(TestHarness harness)
- {
- Color c1 = new Color(1, 2, 3);
- Color c2 = new Color(1, 2, 3);
- harness.check(c1.hashCode() == c2.hashCode());
-
- harness.check(Color.black.hashCode() == new Color(0, 0, 0).hashCode());
- harness.check(Color.white.hashCode() == new Color(255, 255, 255).hashCode());
- }
-
-}
Index: gnu/testlet/java/awt/Color/serialization.java
===================================================================
RCS file: gnu/testlet/java/awt/Color/serialization.java
diff -N gnu/testlet/java/awt/Color/serialization.java
--- gnu/testlet/java/awt/Color/serialization.java 16 May 2005 21:47:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,68 +0,0 @@
-// Tags: JDK1.2
-
-// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-
-package gnu.testlet.java.awt.Color;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Color;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-
-/**
- * Some checks for serialization of a {@link Color} instance.
- */
-public class serialization implements Testlet
-{
-
- /**
- * Runs the test using the specified harness.
- *
- * @param harness the test harness (<code>null</code> not permitted).
- */
- public void test(TestHarness harness)
- {
- Color c1 = new Color(1, 2, 3, 4);
- Color c2 = null;
- try {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutput out = new ObjectOutputStream(buffer);
- out.writeObject(c1);
- out.close();
-
- ObjectInput in = new ObjectInputStream(
- new ByteArrayInputStream(buffer.toByteArray())
- );
- c2 = (Color) in.readObject();
- in.close();
- }
- catch (Exception e) {
- harness.debug(e);
- }
- harness.check(c1.equals(c2));
- }
-
-}
Index: gnu/testlet/java/awt/Event/constants.java
===================================================================
RCS file: gnu/testlet/java/awt/Event/constants.java
diff -N gnu/testlet/java/awt/Event/constants.java
--- gnu/testlet/java/awt/Event/constants.java 28 Oct 2004 11:21:21 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,104 +0,0 @@
-// Tags: JDK1.4
-
-// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
-
-// 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA. */
-
-package gnu.testlet.java.awt.Event;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Event;
-
-/**
- * Verifies constant values for the {@link Event} class.
- */
-public class constants 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.check(Event.ACTION_EVENT, 1001);
- harness.check(Event.ALT_MASK, 8);
- harness.check(Event.BACK_SPACE, 8);
- harness.check(Event.CAPS_LOCK, 1022);
- harness.check(Event.CTRL_MASK, 2);
- harness.check(Event.DELETE, 127);
- harness.check(Event.DOWN, 1005);
- harness.check(Event.END, 1001);
- harness.check(Event.ENTER, 10);
- harness.check(Event.ESCAPE, 27);
- harness.check(Event.F1, 1008);
- harness.check(Event.F10, 1017);
- harness.check(Event.F11, 1018);
- harness.check(Event.F12, 1019);
- harness.check(Event.F2, 1009);
- harness.check(Event.F3, 1010);
- harness.check(Event.F4, 1011);
- harness.check(Event.F5, 1012);
- harness.check(Event.F6, 1013);
- harness.check(Event.F7, 1014);
- harness.check(Event.F8, 1015);
- harness.check(Event.F9, 1016);
- harness.check(Event.GOT_FOCUS, 1004);
- harness.check(Event.HOME, 1000);
- harness.check(Event.INSERT, 1025);
- harness.check(Event.KEY_ACTION, 403);
- harness.check(Event.KEY_ACTION_RELEASE, 404);
- harness.check(Event.KEY_PRESS, 401);
- harness.check(Event.KEY_RELEASE, 402);
- harness.check(Event.LEFT, 1006);
- harness.check(Event.LIST_DESELECT, 702);
- harness.check(Event.LIST_SELECT, 701);
- harness.check(Event.LOAD_FILE, 1002);
- harness.check(Event.LOST_FOCUS, 1005);
- harness.check(Event.META_MASK, 4);
- harness.check(Event.MOUSE_DOWN, 501);
- harness.check(Event.MOUSE_DRAG, 506);
- harness.check(Event.MOUSE_ENTER, 504);
- harness.check(Event.MOUSE_EXIT, 505);
- harness.check(Event.MOUSE_MOVE, 503);
- harness.check(Event.MOUSE_UP, 502);
- harness.check(Event.NUM_LOCK, 1023);
- harness.check(Event.PAUSE, 1024);
- harness.check(Event.PGDN, 1003);
- harness.check(Event.PGUP, 1002);
- harness.check(Event.PRINT_SCREEN, 1020);
- harness.check(Event.RIGHT, 1007);
- harness.check(Event.SAVE_FILE, 1003);
- harness.check(Event.SCROLL_ABSOLUTE, 605);
- harness.check(Event.SCROLL_BEGIN, 606);
- harness.check(Event.SCROLL_END, 607);
- harness.check(Event.SCROLL_LINE_DOWN, 602);
- harness.check(Event.SCROLL_LINE_UP, 601);
- harness.check(Event.SCROLL_LOCK, 1021);
- harness.check(Event.SCROLL_PAGE_DOWN, 604);
- harness.check(Event.SCROLL_PAGE_UP, 603);
- harness.check(Event.SHIFT_MASK, 1);
- harness.check(Event.TAB, 9);
- harness.check(Event.UP, 1004);
- harness.check(Event.WINDOW_DEICONIFY, 204);
- harness.check(Event.WINDOW_DESTROY, 201);
- harness.check(Event.WINDOW_EXPOSE, 202);
- harness.check(Event.WINDOW_ICONIFY, 203);
- harness.check(Event.WINDOW_MOVED, 205);
- }
-}
\ No newline at end of file
Index: gnu/testlet/java/awt/Font/decode.java
===================================================================
RCS file: gnu/testlet/java/awt/Font/decode.java
diff -N gnu/testlet/java/awt/Font/decode.java
--- gnu/testlet/java/awt/Font/decode.java 7 Mar 2005 15:53:00 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,90 +0,0 @@
-// Tags: JDK1.1
-
-// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA. */
-
-package gnu.testlet.java.awt.Font;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Font;
-
-/**
- * Some checks for the decode() method.
- */
-public class decode implements Testlet
-{
- /**
- * Some checks for the decode() method.
- *
- * @param harness the test harness.
- */
- public void test(TestHarness harness)
- {
- // regular usage...
- Font f1 = Font.decode("Dialog-PLAIN-18");
- harness.check(f1.getFamily(), "Dialog"); // check 1
- harness.check(f1.getStyle(), Font.PLAIN); // check 2
- harness.check(f1.getSize(), 18); // check 3
-
- // spaces are acceptable too...
- f1 = Font.decode("Dialog BOLD 16");
- harness.check(f1.getFamily(), "Dialog"); // check 4
- harness.check(f1.getStyle(), Font.BOLD); // check 5
- harness.check(f1.getSize(), 16); // check 6
-
- // unknown name defaults to 'Dialog'
- f1 = Font.decode("123-PLAIN-18");
- harness.check(f1.getFamily(), "Dialog"); // check 7
- harness.check(f1.getStyle(), Font.PLAIN); // check 8
- harness.check(f1.getSize(), 18); // check 9
-
- // style is not case sensitive
- f1 = Font.decode("Dialog-BoLd-17");
- harness.check(f1.getFamily(), "Dialog"); // check 10
- harness.check(f1.getStyle(), Font.BOLD); // check 11
- harness.check(f1.getSize(), 17); // check 12
-
- // unknown style reverts to PLAIN
- f1 = Font.decode("Dialog-NotAStyle-18");
- harness.check(f1.getFamily(), "Dialog"); // check 13
- harness.check(f1.getStyle(), Font.PLAIN); // check 14
- harness.check(f1.getSize(), 18); // check 15
-
- // invalid size defaults to 12
- f1 = Font.decode("Dialog-BOLDITALIC-ZZ");
- harness.check(f1.getFamily(), "Dialog"); // check 16
- harness.check(f1.getStyle(), Font.BOLD + Font.ITALIC); // check 17
- harness.check(f1.getSize(), 12); // check 18
-
- f1 = Font.decode("Dialog");
- harness.check(f1.getFamily(), "Dialog"); // check 19
- harness.check(f1.getStyle(), Font.PLAIN); // check 20
- harness.check(f1.getSize(), 12); // check 21
-
- // null should be equivalent to 'Dialog-PLAIN-12'
- f1 = Font.decode(null);
- harness.check(f1.getFamily(), "Dialog"); // check 22
- harness.check(f1.getStyle(), Font.PLAIN); // check 23
- harness.check(f1.getSize(), 12); // check 24
-
- }
-
-}
\ No newline at end of file
Index: gnu/testlet/java/awt/Font/serialization.java
===================================================================
RCS file: gnu/testlet/java/awt/Font/serialization.java
diff -N gnu/testlet/java/awt/Font/serialization.java
--- gnu/testlet/java/awt/Font/serialization.java 7 Mar 2005 23:19:15 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,69 +0,0 @@
-// Tags: JDK1.1
-
-// Copyright (C) 2004 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-
-package gnu.testlet.java.awt.Font;
-
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
-import java.awt.Font;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-
-/**
- * Some checks for serialization of the {@link Font} class.
- */
-public class serialization implements Testlet
-{
-
- /**
- * Runs the test using the specified harness.
- *
- * @param harness the test harness (<code>null</code> not permitted).
- */
- public void test(TestHarness harness)
- {
- Font f1 = new Font("Dialog", Font.PLAIN, 14);
- Font f2 = null;
-
- try {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutput out = new ObjectOutputStream(buffer);
- out.writeObject(f1);
- out.close();
-
- ObjectInput in = new ObjectInputStream(
- new ByteArrayInputStream(buffer.toByteArray())
- );
- f2 = (Font) in.readObject();
- in.close();
- }
- catch (Exception e) {
- harness.debug(e);
- }
- harness.check(f1.equals(f2));
- }
-
-}
Index: gnu/testlet/java/awt/ColorClass/constants.java
===================================================================
RCS file: gnu/testlet/java/awt/ColorClass/constants.java
diff -N gnu/testlet/java/awt/ColorClass/constants.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/ColorClass/constants.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,57 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.awt.ColorClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+
+/**
+ * Some checks for the constants defined by the {@link Color} class.
+ */
+public class constants 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.check(Color.black.equals(new Color(0, 0, 0)));
+ harness.check(Color.blue.equals(new Color(0, 0, 255)));
+ harness.check(Color.cyan.equals(new Color(0, 255, 255)));
+ harness.check(Color.darkGray.equals(new Color(64, 64, 64)));
+ harness.check(Color.gray.equals(new Color(128, 128, 128)));
+ harness.check(Color.green.equals(new Color(0, 255, 0)));
+ harness.check(Color.lightGray.equals(new Color(192, 192, 192)));
+ harness.check(Color.magenta.equals(new Color(255, 0, 255)));
+ harness.check(Color.orange.equals(new Color(255, 200, 0)));
+ harness.check(Color.pink.equals(new Color(255, 175, 175)));
+ harness.check(Color.red.equals(new Color(255, 0, 0)));
+ harness.check(Color.white.equals(new Color(255, 255, 255)));
+ harness.check(Color.yellow.equals(new Color(255, 255, 0)));
+ }
+
+}
Index: gnu/testlet/java/awt/ColorClass/constructors.java
===================================================================
RCS file: gnu/testlet/java/awt/ColorClass/constructors.java
diff -N gnu/testlet/java/awt/ColorClass/constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/ColorClass/constructors.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,480 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.awt.ColorClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+import java.awt.color.ColorSpace;
+
+/**
+ * Some checks for the constructors in the {@link Color} 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);
+ testConstructor3(harness);
+ testConstructor4(harness);
+ testConstructor5(harness);
+ testConstructor6(harness);
+ testConstructor7(harness);
+ }
+
+ private void testConstructor1(TestHarness harness)
+ {
+ harness.checkPoint("(ColorSpace, float[], float)");
+ Color c = new Color(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+ new float[] { 0.2f, 0.4f, 0.6f}, 0.8f);
+ harness.check(c.getRed(), 51);
+ harness.check(c.getGreen(), 102);
+ harness.check(c.getBlue(), 153);
+ harness.check(c.getAlpha(), 204);
+
+ // try null space
+ boolean pass = false;
+ try
+ {
+ c = new Color(null, new float[] { 0.2f, 0.4f, 0.6f}, 0.8f);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+ private void testConstructor2(TestHarness harness)
+ {
+ harness.checkPoint("(float, float, float)");
+ Color c = new Color(0.2f, 0.4f, 0.6f);
+ harness.check(c.getRed(), 51);
+ harness.check(c.getGreen(), 102);
+ harness.check(c.getBlue(), 153);
+ harness.check(c.getAlpha(), 255);
+
+ // negative red
+ boolean pass = false;
+ try
+ {
+ c = new Color(-0.2f, 0.4f, 0.6f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // negative green
+ pass = false;
+ try
+ {
+ c = new Color(0.2f, -0.4f, 0.6f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // negative blue
+ pass = false;
+ try
+ {
+ c = new Color(0.2f, 0.4f, -0.6f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // red > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(1.2f, 0.4f, 0.6f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // green > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(0.2f, 1.4f, 0.6f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // blue > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(0.2f, 0.4f, 1.6f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ }
+
+ private void testConstructor3(TestHarness harness)
+ {
+ harness.checkPoint("(float, float, float, float)");
+ Color c = new Color(0.2f, 0.4f, 0.6f, 0.8f);
+ harness.check(c.getRed(), 51);
+ harness.check(c.getGreen(), 102);
+ harness.check(c.getBlue(), 153);
+ harness.check(c.getAlpha(), 204);
+
+ // negative red
+ boolean pass = false;
+ try
+ {
+ c = new Color(-0.2f, 0.4f, 0.6f, 0.8f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // negative green
+ pass = false;
+ try
+ {
+ c = new Color(0.2f, -0.4f, 0.6f, 0.8f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // negative blue
+ pass = false;
+ try
+ {
+ c = new Color(0.2f, 0.4f, -0.6f, 0.8f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // negative alpha
+ pass = false;
+ try
+ {
+ c = new Color(0.2f, 0.4f, 0.6f, -0.8f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // red > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(1.2f, 0.4f, 0.6f, 0.8f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // green > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(0.2f, 1.4f, 0.6f, 0.8f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // blue > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(0.2f, 0.4f, 1.6f, 0.8f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // alpha > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(0.2f, 0.4f, 0.6f, 1.8f);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ }
+
+ private void testConstructor4(TestHarness harness)
+ {
+ harness.checkPoint("(int)");
+ Color c = new Color(0x12345678);
+ harness.check(c.getRed(), 0x34);
+ harness.check(c.getGreen(), 0x56);
+ harness.check(c.getBlue(), 0x78);
+ harness.check(c.getAlpha(), 0xFF);
+ }
+
+ private void testConstructor5(TestHarness harness)
+ {
+ harness.checkPoint("(int, boolean)");
+ Color c = new Color(0x12345678, false);
+ harness.check(c.getRed(), 0x34);
+ harness.check(c.getGreen(), 0x56);
+ harness.check(c.getBlue(), 0x78);
+ harness.check(c.getAlpha(), 0xFF);
+
+ c = new Color(0x12345678, true);
+ harness.check(c.getRed(), 0x34);
+ harness.check(c.getGreen(), 0x56);
+ harness.check(c.getBlue(), 0x78);
+ harness.check(c.getAlpha(), 0x12);
+ }
+
+ private void testConstructor6(TestHarness harness)
+ {
+ harness.checkPoint("(int, int, int)");
+ Color c = new Color(12, 34, 56);
+ harness.check(c.getRed(), 12);
+ harness.check(c.getGreen(), 34);
+ harness.check(c.getBlue(), 56);
+ harness.check(c.getAlpha(), 255);
+
+ // negative red
+ boolean pass = false;
+ try
+ {
+ c = new Color(-12, 34, 56);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // negative green
+ pass = false;
+ try
+ {
+ c = new Color(12, -34, 56);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // negative blue
+ pass = false;
+ try
+ {
+ c = new Color(12, 34, -56);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // red > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(512, 34, 56);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // green > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(12, 534, 56);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // blue > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(12, 34, 556);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+ private void testConstructor7(TestHarness harness)
+ {
+ harness.checkPoint("(int, int, int, int)");
+ Color c = new Color(12, 34, 56, 78);
+ harness.check(c.getRed(), 12);
+ harness.check(c.getGreen(), 34);
+ harness.check(c.getBlue(), 56);
+ harness.check(c.getAlpha(), 78);
+
+ // negative red
+ boolean pass = false;
+ try
+ {
+ c = new Color(-12, 34, 56, 78);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // negative green
+ pass = false;
+ try
+ {
+ c = new Color(12, -34, 56, 78);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // negative blue
+ pass = false;
+ try
+ {
+ c = new Color(12, 34, -56, 78);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // negative alpha
+ pass = false;
+ try
+ {
+ c = new Color(12, 34, 56, -78);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // red > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(512, 34, 56, 78);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // green > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(12, 534, 56, 78);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // blue > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(12, 34, 556, 78);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // alpha > 1.0
+ pass = false;
+ try
+ {
+ c = new Color(12, 34, 56, 578);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ }
+
+}
Index: gnu/testlet/java/awt/ColorClass/decode.java
===================================================================
RCS file: gnu/testlet/java/awt/ColorClass/decode.java
diff -N gnu/testlet/java/awt/ColorClass/decode.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/ColorClass/decode.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,73 @@
+// Tags: JDK1.1
+
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.awt.ColorClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+
+/**
+ * Some checks for the decode() method in the {@link Color} class.
+ */
+public class decode implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Color c = Color.decode("0x010203");
+ harness.check(c.getRed(), 1);
+ harness.check(c.getGreen(), 2);
+ harness.check(c.getBlue(), 3);
+
+ // try a null argument - see bug parade 6211249
+ boolean pass = false;
+ try
+ {
+ Color.decode(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try a non-numeric string
+ pass = false;
+ try
+ {
+ Color.decode("XYZ");
+ }
+ catch (NumberFormatException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ }
+
+}
Index: gnu/testlet/java/awt/ColorClass/equals.java
===================================================================
RCS file: gnu/testlet/java/awt/ColorClass/equals.java
diff -N gnu/testlet/java/awt/ColorClass/equals.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/ColorClass/equals.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,80 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.awt.ColorClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+
+/**
+ * Checks that the equals() method in the {@link Color} class works
+ * correctly.
+ */
+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)
+ {
+ Color c1 = new Color(1, 2, 3);
+ Color c2 = new Color(1, 2, 3);
+ harness.check(c1.equals(c2));
+ harness.check(c2.equals(c1));
+
+ c1 = new Color(1, 2, 3, 4);
+ harness.check(!c1.equals(c2));
+ c2 = new Color(1, 2, 3, 4);
+ harness.check(c1.equals(c2));
+
+ c1 = new Color(5, 2, 3, 4);
+ harness.check(!c1.equals(c2));
+ c2 = new Color(5, 2, 3, 4);
+ harness.check(c1.equals(c2));
+
+ c1 = new Color(5, 6, 3, 4);
+ harness.check(!c1.equals(c2));
+ c2 = new Color(5, 6, 3, 4);
+ harness.check(c1.equals(c2));
+
+ c1 = new Color(5, 6, 7, 4);
+ harness.check(!c1.equals(c2));
+ c2 = new Color(5, 6, 7, 4);
+ harness.check(c1.equals(c2));
+
+ c1 = new Color(5, 6, 7, 8);
+ harness.check(!c1.equals(c2));
+ c2 = new Color(5, 6, 7, 8);
+ harness.check(c1.equals(c2));
+
+ // check null argument
+ harness.check(!c1.equals(null));
+
+ // check non-Color argument
+ harness.check(!c1.equals("XYZ"));
+ }
+
+}
Index: gnu/testlet/java/awt/ColorClass/getBlue.java
===================================================================
RCS file: gnu/testlet/java/awt/ColorClass/getBlue.java
diff -N gnu/testlet/java/awt/ColorClass/getBlue.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/ColorClass/getBlue.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,49 @@
+// Tags: JDK1.1
+
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.awt.ColorClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+
+/**
+ * Some checks for the getBlue() method in the {@link Color} class.
+ */
+public class getBlue implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Color c = new Color(1, 2, 3);
+ harness.check(c.getBlue(), 3);
+
+ c = new Color(243, 244, 245);
+ harness.check(c.getBlue(), 245);
+ }
+
+}
Index: gnu/testlet/java/awt/ColorClass/getGreen.java
===================================================================
RCS file: gnu/testlet/java/awt/ColorClass/getGreen.java
diff -N gnu/testlet/java/awt/ColorClass/getGreen.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/ColorClass/getGreen.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,49 @@
+// Tags: JDK1.1
+
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.awt.ColorClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+
+/**
+ * Some checks for the getGreen() method in the {@link Color} class.
+ */
+public class getGreen implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Color c = new Color(1, 2, 3);
+ harness.check(c.getGreen(), 2);
+
+ c = new Color(243, 244, 245);
+ harness.check(c.getGreen(), 244);
+ }
+
+}
Index: gnu/testlet/java/awt/ColorClass/getRed.java
===================================================================
RCS file: gnu/testlet/java/awt/ColorClass/getRed.java
diff -N gnu/testlet/java/awt/ColorClass/getRed.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/ColorClass/getRed.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,49 @@
+// Tags: JDK1.1
+
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.awt.ColorClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+
+/**
+ * Some checks for the getRed() method in the {@link Color} class.
+ */
+public class getRed implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Color c = new Color(1, 2, 3);
+ harness.check(c.getRed(), 1);
+
+ c = new Color(243, 244, 245);
+ harness.check(c.getRed(), 243);
+ }
+
+}
Index: gnu/testlet/java/awt/ColorClass/hashCode.java
===================================================================
RCS file: gnu/testlet/java/awt/ColorClass/hashCode.java
diff -N gnu/testlet/java/awt/ColorClass/hashCode.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/ColorClass/hashCode.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,50 @@
+// Tags: JDK1.1
+
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.awt.ColorClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+
+/**
+ * Some checks for the hashCode() method in the {@link Color} class works.
+ */
+public class hashCode implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Color c1 = new Color(1, 2, 3);
+ Color c2 = new Color(1, 2, 3);
+ harness.check(c1.hashCode() == c2.hashCode());
+
+ harness.check(Color.black.hashCode() == new Color(0, 0, 0).hashCode());
+ harness.check(Color.white.hashCode() == new Color(255, 255, 255).hashCode());
+ }
+
+}
Index: gnu/testlet/java/awt/ColorClass/serialization.java
===================================================================
RCS file: gnu/testlet/java/awt/ColorClass/serialization.java
diff -N gnu/testlet/java/awt/ColorClass/serialization.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/ColorClass/serialization.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,68 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.ColorClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+
+/**
+ * Some checks for serialization of a {@link Color} instance.
+ */
+public class serialization implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Color c1 = new Color(1, 2, 3, 4);
+ Color c2 = null;
+ try {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ObjectOutput out = new ObjectOutputStream(buffer);
+ out.writeObject(c1);
+ out.close();
+
+ ObjectInput in = new ObjectInputStream(
+ new ByteArrayInputStream(buffer.toByteArray())
+ );
+ c2 = (Color) in.readObject();
+ in.close();
+ }
+ catch (Exception e) {
+ harness.debug(e);
+ }
+ harness.check(c1.equals(c2));
+ }
+
+}
Index: gnu/testlet/java/awt/EventClass/constants.java
===================================================================
RCS file: gnu/testlet/java/awt/EventClass/constants.java
diff -N gnu/testlet/java/awt/EventClass/constants.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/EventClass/constants.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,104 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.awt.EventClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Event;
+
+/**
+ * Verifies constant values for the {@link Event} class.
+ */
+public class constants 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.check(Event.ACTION_EVENT, 1001);
+ harness.check(Event.ALT_MASK, 8);
+ harness.check(Event.BACK_SPACE, 8);
+ harness.check(Event.CAPS_LOCK, 1022);
+ harness.check(Event.CTRL_MASK, 2);
+ harness.check(Event.DELETE, 127);
+ harness.check(Event.DOWN, 1005);
+ harness.check(Event.END, 1001);
+ harness.check(Event.ENTER, 10);
+ harness.check(Event.ESCAPE, 27);
+ harness.check(Event.F1, 1008);
+ harness.check(Event.F10, 1017);
+ harness.check(Event.F11, 1018);
+ harness.check(Event.F12, 1019);
+ harness.check(Event.F2, 1009);
+ harness.check(Event.F3, 1010);
+ harness.check(Event.F4, 1011);
+ harness.check(Event.F5, 1012);
+ harness.check(Event.F6, 1013);
+ harness.check(Event.F7, 1014);
+ harness.check(Event.F8, 1015);
+ harness.check(Event.F9, 1016);
+ harness.check(Event.GOT_FOCUS, 1004);
+ harness.check(Event.HOME, 1000);
+ harness.check(Event.INSERT, 1025);
+ harness.check(Event.KEY_ACTION, 403);
+ harness.check(Event.KEY_ACTION_RELEASE, 404);
+ harness.check(Event.KEY_PRESS, 401);
+ harness.check(Event.KEY_RELEASE, 402);
+ harness.check(Event.LEFT, 1006);
+ harness.check(Event.LIST_DESELECT, 702);
+ harness.check(Event.LIST_SELECT, 701);
+ harness.check(Event.LOAD_FILE, 1002);
+ harness.check(Event.LOST_FOCUS, 1005);
+ harness.check(Event.META_MASK, 4);
+ harness.check(Event.MOUSE_DOWN, 501);
+ harness.check(Event.MOUSE_DRAG, 506);
+ harness.check(Event.MOUSE_ENTER, 504);
+ harness.check(Event.MOUSE_EXIT, 505);
+ harness.check(Event.MOUSE_MOVE, 503);
+ harness.check(Event.MOUSE_UP, 502);
+ harness.check(Event.NUM_LOCK, 1023);
+ harness.check(Event.PAUSE, 1024);
+ harness.check(Event.PGDN, 1003);
+ harness.check(Event.PGUP, 1002);
+ harness.check(Event.PRINT_SCREEN, 1020);
+ harness.check(Event.RIGHT, 1007);
+ harness.check(Event.SAVE_FILE, 1003);
+ harness.check(Event.SCROLL_ABSOLUTE, 605);
+ harness.check(Event.SCROLL_BEGIN, 606);
+ harness.check(Event.SCROLL_END, 607);
+ harness.check(Event.SCROLL_LINE_DOWN, 602);
+ harness.check(Event.SCROLL_LINE_UP, 601);
+ harness.check(Event.SCROLL_LOCK, 1021);
+ harness.check(Event.SCROLL_PAGE_DOWN, 604);
+ harness.check(Event.SCROLL_PAGE_UP, 603);
+ harness.check(Event.SHIFT_MASK, 1);
+ harness.check(Event.TAB, 9);
+ harness.check(Event.UP, 1004);
+ harness.check(Event.WINDOW_DEICONIFY, 204);
+ harness.check(Event.WINDOW_DESTROY, 201);
+ harness.check(Event.WINDOW_EXPOSE, 202);
+ harness.check(Event.WINDOW_ICONIFY, 203);
+ harness.check(Event.WINDOW_MOVED, 205);
+ }
+}
Index: gnu/testlet/java/awt/FontClass/decode.java
===================================================================
RCS file: gnu/testlet/java/awt/FontClass/decode.java
diff -N gnu/testlet/java/awt/FontClass/decode.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/FontClass/decode.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,90 @@
+// Tags: JDK1.1
+
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.awt.FontClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Font;
+
+/**
+ * Some checks for the decode() method.
+ */
+public class decode implements Testlet
+{
+ /**
+ * Some checks for the decode() method.
+ *
+ * @param harness the test harness.
+ */
+ public void test(TestHarness harness)
+ {
+ // regular usage...
+ Font f1 = Font.decode("Dialog-PLAIN-18");
+ harness.check(f1.getFamily(), "Dialog"); // check 1
+ harness.check(f1.getStyle(), Font.PLAIN); // check 2
+ harness.check(f1.getSize(), 18); // check 3
+
+ // spaces are acceptable too...
+ f1 = Font.decode("Dialog BOLD 16");
+ harness.check(f1.getFamily(), "Dialog"); // check 4
+ harness.check(f1.getStyle(), Font.BOLD); // check 5
+ harness.check(f1.getSize(), 16); // check 6
+
+ // unknown name defaults to 'Dialog'
+ f1 = Font.decode("123-PLAIN-18");
+ harness.check(f1.getFamily(), "Dialog"); // check 7
+ harness.check(f1.getStyle(), Font.PLAIN); // check 8
+ harness.check(f1.getSize(), 18); // check 9
+
+ // style is not case sensitive
+ f1 = Font.decode("Dialog-BoLd-17");
+ harness.check(f1.getFamily(), "Dialog"); // check 10
+ harness.check(f1.getStyle(), Font.BOLD); // check 11
+ harness.check(f1.getSize(), 17); // check 12
+
+ // unknown style reverts to PLAIN
+ f1 = Font.decode("Dialog-NotAStyle-18");
+ harness.check(f1.getFamily(), "Dialog"); // check 13
+ harness.check(f1.getStyle(), Font.PLAIN); // check 14
+ harness.check(f1.getSize(), 18); // check 15
+
+ // invalid size defaults to 12
+ f1 = Font.decode("Dialog-BOLDITALIC-ZZ");
+ harness.check(f1.getFamily(), "Dialog"); // check 16
+ harness.check(f1.getStyle(), Font.BOLD + Font.ITALIC); // check 17
+ harness.check(f1.getSize(), 12); // check 18
+
+ f1 = Font.decode("Dialog");
+ harness.check(f1.getFamily(), "Dialog"); // check 19
+ harness.check(f1.getStyle(), Font.PLAIN); // check 20
+ harness.check(f1.getSize(), 12); // check 21
+
+ // null should be equivalent to 'Dialog-PLAIN-12'
+ f1 = Font.decode(null);
+ harness.check(f1.getFamily(), "Dialog"); // check 22
+ harness.check(f1.getStyle(), Font.PLAIN); // check 23
+ harness.check(f1.getSize(), 12); // check 24
+
+ }
+
+}
Index: gnu/testlet/java/awt/FontClass/serialization.java
===================================================================
RCS file: gnu/testlet/java/awt/FontClass/serialization.java
diff -N gnu/testlet/java/awt/FontClass/serialization.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/FontClass/serialization.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,69 @@
+// Tags: JDK1.1
+
+// Copyright (C) 2004 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, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.FontClass;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Font;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+
+/**
+ * Some checks for serialization of the {@link Font} class.
+ */
+public class serialization implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Font f1 = new Font("Dialog", Font.PLAIN, 14);
+ Font f2 = null;
+
+ try {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ObjectOutput out = new ObjectOutputStream(buffer);
+ out.writeObject(f1);
+ out.close();
+
+ ObjectInput in = new ObjectInputStream(
+ new ByteArrayInputStream(buffer.toByteArray())
+ );
+ f2 = (Font) in.readObject();
+ in.close();
+ }
+ catch (Exception e) {
+ harness.debug(e);
+ }
+ harness.check(f1.equals(f2));
+ }
+
+}