This is the mail archive of the
mauve-patches@sources.redhat.com
mailing list for the Mauve project.
java.awt.Point
- From: David Gilbert <david dot gilbert at object-refinery dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Wed, 20 Oct 2004 10:16:46 +0100
- Subject: java.awt.Point
I've committed this patch (see attached):
2004-10-20 David Gilbert <david.gilbert@object-refinery.com>
* gnu/testlet/java/awt/Point/clone.java: New test.
* gnu/testlet/java/awt/Point/constructors.java: Likewise.
* gnu/testlet/java/awt/Point/equals.java: Likewise.
* gnu/testlet/java/awt/Point/getLocation.java: Likewise.
* gnu/testlet/java/awt/Point/move.java: Likewise.
* gnu/testlet/java/awt/Point/setLocation.java: Likewise.
* gnu/testlet/java/awt/Point/translate.java: Likewise.
All checks pass for me using JamVM 1.2.0 and a recent CVS version of
Classpath.
Regards,
Dave Gilbert
http://www.jfree.org
Index: ChangeLog
===================================================================
RCS file: /cvs/mauve/mauve/ChangeLog,v
retrieving revision 1.700
diff -u -r1.700 ChangeLog
--- ChangeLog 20 Oct 2004 08:52:59 -0000 1.700
+++ ChangeLog 20 Oct 2004 09:06:58 -0000
@@ -1,5 +1,15 @@
2004-10-20 David Gilbert <david.gilbert@object-refinery.com>
+ * gnu/testlet/java/awt/Point/clone.java: New test.
+ * gnu/testlet/java/awt/Point/constructors.java: Likewise.
+ * gnu/testlet/java/awt/Point/equals.java: Likewise.
+ * gnu/testlet/java/awt/Point/getLocation.java: Likewise.
+ * gnu/testlet/java/awt/Point/move.java: Likewise.
+ * gnu/testlet/java/awt/Point/setLocation.java: Likewise.
+ * gnu/testlet/java/awt/Point/translate.java: Likewise.
+
+2004-10-20 David Gilbert <david.gilbert@object-refinery.com>
+
* gnu/testlet/java/awt/BasicStroke/constants.java: New test.
* gnu/testlet/java/awt/BasicStroke/constructors.java: Likewise.
* gnu/testlet/java/awt/BasicStroke/equals.java: Likewise.
Index: gnu/testlet/java/awt/Point/clone.java
===================================================================
RCS file: gnu/testlet/java/awt/Point/clone.java
diff -N gnu/testlet/java/awt/Point/clone.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/Point/clone.java 20 Oct 2004 09:06:58 -0000
@@ -0,0 +1,46 @@
+// Tags: JDK1.1
+
+// 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.Point;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Point;
+
+/**
+ * Some checks for the clone() method in the {@link Point} class.
+ */
+public class clone implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Point p1 = new Point(10, 11);
+ Point p2 = null;
+ p2 = (Point) p1.clone();
+ harness.check(p1.equals(p2));
+ harness.check(p1 != p2);
+ }
+
+}
Index: gnu/testlet/java/awt/Point/constructors.java
===================================================================
RCS file: gnu/testlet/java/awt/Point/constructors.java
diff -N gnu/testlet/java/awt/Point/constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/Point/constructors.java 20 Oct 2004 09:06:59 -0000
@@ -0,0 +1,75 @@
+// Tags: JDK1.1
+
+// 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.Point;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Point;
+
+/**
+ * Some checks for the constructors in the {@link Point} 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);
+ }
+
+ private void testConstructor1(TestHarness harness)
+ {
+ Point p = new Point();
+ harness.check(p.x, 0);
+ harness.check(p.y, 0);
+ }
+
+ private void testConstructor2(TestHarness harness)
+ {
+ Point p = new Point(1, 2);
+ harness.check(p.x, 1);
+ harness.check(p.y, 2);
+ }
+
+ private void testConstructor3(TestHarness harness)
+ {
+ Point p = new Point(new Point(2, 3));
+ harness.check(p.x, 2);
+ harness.check(p.y, 3);
+
+ try
+ {
+ p = new Point(null);
+ harness.check(false);
+ }
+ catch (NullPointerException e)
+ {
+ harness.check(true);
+ }
+ }
+
+}
Index: gnu/testlet/java/awt/Point/equals.java
===================================================================
RCS file: gnu/testlet/java/awt/Point/equals.java
diff -N gnu/testlet/java/awt/Point/equals.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/Point/equals.java 20 Oct 2004 09:06:59 -0000
@@ -0,0 +1,60 @@
+// Tags: JDK1.1
+
+// 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.Point;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Point;
+import java.awt.geom.Point2D;
+
+/**
+ * Some checks for the equals() method in the {@link Point} class.
+ */
+public class equals implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Point p1 = new Point();
+ Point p2 = new Point();
+ harness.check(p1.equals(p2));
+
+ p1 = new Point(1, 0);
+ harness.check(!p1.equals(p2));
+ p2 = new Point(1, 0);
+ harness.check(p1.equals(p2));
+
+ p1 = new Point(1, 2);
+ harness.check(!p1.equals(p2));
+ p2 = new Point(1, 2);
+ harness.check(p1.equals(p2));
+
+ harness.check(!p1.equals(null));
+
+ Point2D p3 = new Point2D.Double(1.0, 2.0);
+ harness.check(p3.equals(p1));
+ }
+
+}
Index: gnu/testlet/java/awt/Point/getLocation.java
===================================================================
RCS file: gnu/testlet/java/awt/Point/getLocation.java
diff -N gnu/testlet/java/awt/Point/getLocation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/Point/getLocation.java 20 Oct 2004 09:06:59 -0000
@@ -0,0 +1,51 @@
+// Tags: JDK1.1
+
+// 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.Point;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Point;
+
+/**
+ * Some checks for the getLocation() method in the {@link Point} class.
+ */
+public class getLocation implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Point p = new Point(1, 2);
+ Point l = p.getLocation();
+ harness.check(l.x, 1);
+ harness.check(l.y, 2);
+
+ // check independence
+ p.setLocation(4, 5);
+ harness.check(l.x, 1);
+ harness.check(l.y, 2);
+ }
+
+
+}
Index: gnu/testlet/java/awt/Point/move.java
===================================================================
RCS file: gnu/testlet/java/awt/Point/move.java
diff -N gnu/testlet/java/awt/Point/move.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/Point/move.java 20 Oct 2004 09:06:59 -0000
@@ -0,0 +1,46 @@
+// Tags: JDK1.1
+
+// 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.Point;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Point;
+
+/**
+ * Some checks for the move() method in the {@link Point} class.
+ */
+public class move implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Point p = new Point();
+ p.move(4, 5);
+ harness.check(p.x, 4);
+ harness.check(p.y, 5);
+ }
+
+
+}
Index: gnu/testlet/java/awt/Point/setLocation.java
===================================================================
RCS file: gnu/testlet/java/awt/Point/setLocation.java
diff -N gnu/testlet/java/awt/Point/setLocation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/Point/setLocation.java 20 Oct 2004 09:06:59 -0000
@@ -0,0 +1,77 @@
+// Tags: JDK1.1
+
+// 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.Point;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Point;
+
+/**
+ * Some checks for the setLocation() method in the {@link Point} class.
+ */
+public class setLocation implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.checkPoint("setLocation(int, int)");
+ Point p = new Point();
+ p.setLocation(4, 5);
+ harness.check(p.x, 4);
+ harness.check(p.y, 5);
+
+ harness.checkPoint("setLocation(Point)");
+ p.setLocation(new Point(6, 7));
+ harness.check(p.x, 6);
+ harness.check(p.y, 7);
+
+ try
+ {
+ p.setLocation(null);
+ harness.check(false);
+ }
+ catch (NullPointerException e)
+ {
+ harness.check(true);
+ }
+
+ harness.checkPoint("setLocation(double, double)");
+ p = new Point();
+ p.setLocation(1.2, 2.3);
+ harness.check(p.x, 1);
+ harness.check(p.y, 2);
+
+ double bigPos = Integer.MAX_VALUE + 10000.0;
+ double bigNeg = Integer.MIN_VALUE - 10000.0;
+ p.setLocation(bigPos, bigPos);
+ harness.check(p.x, Integer.MAX_VALUE);
+ harness.check(p.y, Integer.MAX_VALUE);
+
+ p.setLocation(bigNeg, bigNeg);
+ harness.check(p.x, Integer.MIN_VALUE);
+ harness.check(p.y, Integer.MIN_VALUE);
+ }
+
+}
Index: gnu/testlet/java/awt/Point/translate.java
===================================================================
RCS file: gnu/testlet/java/awt/Point/translate.java
diff -N gnu/testlet/java/awt/Point/translate.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/Point/translate.java 20 Oct 2004 09:06:59 -0000
@@ -0,0 +1,46 @@
+// Tags: JDK1.1
+
+// 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.Point;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Point;
+
+/**
+ * Some checks for the translate() method in the {@link Point} class.
+ */
+public class translate implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Point p = new Point(1, 2);
+ p.translate(3, 4);
+ harness.check(p.x, 4);
+ harness.check(p.y, 6);
+ }
+
+
+}