This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: More tests for java.awt.image.*
- From: David Gilbert <david dot gilbert at object-refinery dot com>
- To: mauve-patches <mauve-patches at sources dot redhat dot com>
- Date: Tue, 18 Jul 2006 17:59:03 +0100
- Subject: FYI: More tests for java.awt.image.*
This patch (committed) adds a number of new tests for java.awt.image.*:
2006-07-18 David Gilbert <david.gilbert@object-refinery.com>
* gnu/testlet/java/awt/image/ByteLookupTable/constructors.java: New
test,
* gnu/testlet/java/awt/image/ByteLookupTable/getTable.java: New test,
* gnu/testlet/java/awt/image/ComponentSampleModel/constructors.java
(testDefensiveCopies): Check m2 not m,
* gnu/testlet/java/awt/image/ComponentSampleModel/createDataBuffer.java
(test): Call new methods,
(testSingleBand): New method,
(testMultiBand): New method,
* gnu/testlet/java/awt/image/ComponentSampleModel/getOffset.java:
New test,
* gnu/testlet/java/awt/image/ComponentSampleModel/getPixel.java: New
test,
* gnu/testlet/java/awt/image/ComponentSampleModel/getSample.java:
New test,
*
gnu/testlet/java/awt/image/ComponentSampleModel/getSampleDouble.java:
New test,
*
gnu/testlet/java/awt/image/ComponentSampleModel/getSampleFloat.java: New
test,
* gnu/testlet/java/awt/image/LookupOp/constructor.java: New test,
*
gnu/testlet/java/awt/image/LookupOp/createCompatibleDestRaster.java: New
test,
* gnu/testlet/java/awt/image/LookupOp/getBounds2D.java: New test,
* gnu/testlet/java/awt/image/LookupOp/getPoint2D.java: New test,
* gnu/testlet/java/awt/image/LookupOp/getRenderingHints.java: New test,
* gnu/testlet/java/awt/image/LookupOp/getTable.java: New test,
* gnu/testlet/java/awt/image/LookupTable/constructor.java: New test,
* gnu/testlet/java/awt/image/LookupTable/getNumComponents.java: New
test,
* gnu/testlet/java/awt/image/LookupTable/getOffset.java: New test,
* gnu/testlet/java/awt/image/LookupTable/MyLookupTable.java: New class,
* gnu/testlet/java/awt/image/ShortLookupTable/constructors.java: New
test,
* gnu/testlet/java/awt/image/ShortLookupTable/getTable.java: New test.
Regards,
Dave
Index: gnu/testlet/java/awt/image/ByteLookupTable/constructors.java
===================================================================
RCS file: gnu/testlet/java/awt/image/ByteLookupTable/constructors.java
diff -N gnu/testlet/java/awt/image/ByteLookupTable/constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/ByteLookupTable/constructors.java 18 Jul 2006 16:49:07 -0000
@@ -0,0 +1,115 @@
+/* constructors.java -- some checks for the constructors in the ByteLookupTable
+ 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.4
+
+package gnu.testlet.java.awt.image.ByteLookupTable;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ByteLookupTable;
+
+public class constructors implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ testConstructor1(harness);
+ testConstructor2(harness);
+ }
+
+ public void testConstructor1(TestHarness harness)
+ {
+ harness.checkPoint("(int, byte[])");
+ byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
+ ByteLookupTable t = new ByteLookupTable(7, bytes);
+ harness.check(t.getOffset(), 7);
+ harness.check(t.getNumComponents(), 1);
+ byte[][] table = t.getTable();
+ harness.check(table.length, 1);
+ harness.check(table[0] == bytes);
+
+ // try negative offset
+ boolean pass = false;
+ try
+ {
+ t = new ByteLookupTable(-1, bytes);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try null data
+ pass = false;
+ try
+ {
+ t = new ByteLookupTable(0, (byte[]) null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+ public void testConstructor2(TestHarness harness)
+ {
+ harness.checkPoint("(int, byte[][])");
+ byte[] bytesA = new byte[] {(byte) 0xAA, (byte) 0xBB, (byte) 0xCC};
+ byte[] bytesB = new byte[] {(byte) 0xDD, (byte) 0xEE, (byte) 0xFF};
+ byte[][] bytes = new byte[][] { bytesA, bytesB };
+ ByteLookupTable t = new ByteLookupTable(3, bytes);
+ harness.check(t.getOffset(), 3);
+ harness.check(t.getNumComponents(), 2);
+ byte[][] table = t.getTable();
+ harness.check(table.length, 2);
+ harness.check(table[0] == bytesA);
+ harness.check(table[1] == bytesB);
+ harness.check(table != bytes);
+
+ // try negative offset
+ boolean pass = false;
+ try
+ {
+ t = new ByteLookupTable(-1, bytes);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try null data
+ pass = false;
+ try
+ {
+ t = new ByteLookupTable(0, (byte[][]) null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+}
Index: gnu/testlet/java/awt/image/ByteLookupTable/getTable.java
===================================================================
RCS file: gnu/testlet/java/awt/image/ByteLookupTable/getTable.java
diff -N gnu/testlet/java/awt/image/ByteLookupTable/getTable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/ByteLookupTable/getTable.java 18 Jul 2006 16:49:07 -0000
@@ -0,0 +1,66 @@
+/* getTable.java -- some checks for the getLookUpTable() method in the
+ ByteLookupTable 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.4
+
+package gnu.testlet.java.awt.image.ByteLookupTable;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ByteLookupTable;
+
+public class getTable implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ test1(harness);
+ test2(harness);
+ }
+
+ public void test1(TestHarness harness)
+ {
+ harness.checkPoint("test1()");
+ byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
+ ByteLookupTable t = new ByteLookupTable(7, bytes);
+ byte[][] table = t.getTable();
+ harness.check(table.length, 1);
+ harness.check(table[0] == bytes);
+ harness.check(t.getTable() == t.getTable());
+ }
+
+ public void test2(TestHarness harness)
+ {
+ harness.checkPoint("test2()");
+ byte[] bytesA = new byte[] {(byte) 0xAA, (byte) 0xBB, (byte) 0xCC};
+ byte[] bytesB = new byte[] {(byte) 0xDD, (byte) 0xEE, (byte) 0xFF};
+ byte[][] bytes = new byte[][] { bytesA, bytesB };
+ ByteLookupTable t = new ByteLookupTable(3, bytes);
+ byte[][] table = t.getTable();
+ harness.check(table.length, 2);
+ harness.check(table[0] == bytesA);
+ harness.check(table[1] == bytesB);
+ harness.check(table != bytes);
+ harness.check(t.getTable() == t.getTable());
+ }
+
+}
Index: gnu/testlet/java/awt/image/ComponentSampleModel/constructors.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/ComponentSampleModel/constructors.java,v
retrieving revision 1.1
diff -u -r1.1 constructors.java
--- gnu/testlet/java/awt/image/ComponentSampleModel/constructors.java 17 Jul 2006 16:34:25 -0000 1.1
+++ gnu/testlet/java/awt/image/ComponentSampleModel/constructors.java 18 Jul 2006 16:49:08 -0000
@@ -162,10 +162,10 @@
int[] bankIndices = new int[] {0, 0, 0};
MyComponentSampleModel m2 = new MyComponentSampleModel(DataBuffer.TYPE_BYTE,
10, 20, 3, 30, bandOffsets, bankIndices);
- harness.check(bandOffsets != m.getBandOffsetsDirect());
- harness.check(Arrays.equals(bandOffsets, m.getBandOffsetsDirect()));
- harness.check(bankIndices != m.getBankIndicesDirect());
- harness.check(Arrays.equals(bankIndices, m.getBankIndicesDirect()));
+ harness.check(bandOffsets != m2.getBandOffsetsDirect());
+ harness.check(Arrays.equals(bandOffsets, m2.getBandOffsetsDirect()));
+ harness.check(bankIndices != m2.getBankIndicesDirect());
+ harness.check(Arrays.equals(bankIndices, m2.getBankIndicesDirect()));
}
}
Index: gnu/testlet/java/awt/image/ComponentSampleModel/createDataBuffer.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/ComponentSampleModel/createDataBuffer.java,v
retrieving revision 1.1
diff -u -r1.1 createDataBuffer.java
--- gnu/testlet/java/awt/image/ComponentSampleModel/createDataBuffer.java 17 Jul 2006 16:34:25 -0000 1.1
+++ gnu/testlet/java/awt/image/ComponentSampleModel/createDataBuffer.java 18 Jul 2006 16:49:08 -0000
@@ -34,11 +34,50 @@
{
public void test(TestHarness harness)
{
+ testSingleBand(harness);
+ testMultiBand(harness);
+ }
+
+ public void testSingleBand(TestHarness harness)
+ {
ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_BYTE, 10,
- 20, 3, 30, new int[] {0, 1, 2});
+ 20, 1, 30, new int[] {0, 1, 2});
DataBuffer db = m.createDataBuffer();
harness.check(db.getDataType(), DataBuffer.TYPE_BYTE);
harness.check(db.getNumBanks(), 1);
- harness.check(db.getSize(), 600);
+ harness.check(db.getSize(), 582);
+
+ m = new ComponentSampleModel(DataBuffer.TYPE_INT, 5, 10, 1, 5,
+ new int[] {0, 1, 2});
+ db = m.createDataBuffer();
+ harness.check(db.getDataType(), DataBuffer.TYPE_INT);
+ harness.check(db.getNumBanks(), 1);
+ harness.check(db.getSize(), 52);
+
+ m = new ComponentSampleModel(DataBuffer.TYPE_INT, 5, 10, 1, 6,
+ new int[] {0, 1, 2});
+ db = m.createDataBuffer();
+ harness.check(db.getDataType(), DataBuffer.TYPE_INT);
+ harness.check(db.getNumBanks(), 1);
+ harness.check(db.getSize(), 61);
+
+ m = new ComponentSampleModel(DataBuffer.TYPE_INT, 5, 10, 2, 10,
+ new int[] {0, 1});
+ db = m.createDataBuffer();
+ harness.check(db.getDataType(), DataBuffer.TYPE_INT);
+ harness.check(db.getNumBanks(), 1);
+ harness.check(db.getSize(), 100);
+ }
+
+ public void testMultiBand(TestHarness harness)
+ {
+ harness.checkPoint("testMultiBand()");
+ ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_BYTE, 10,
+ 20, 1, 10, new int[] {0, 1, 2}, new int[] {0, 0, 0});
+ DataBuffer db = m.createDataBuffer();
+ harness.check(db.getDataType(), DataBuffer.TYPE_BYTE);
+ harness.check(db.getNumBanks(), 3);
+ harness.check(db.getSize(), 200);
+
}
}
Index: gnu/testlet/java/awt/image/ComponentSampleModel/getOffset.java
===================================================================
RCS file: gnu/testlet/java/awt/image/ComponentSampleModel/getOffset.java
diff -N gnu/testlet/java/awt/image/ComponentSampleModel/getOffset.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/ComponentSampleModel/getOffset.java 18 Jul 2006 16:49:08 -0000
@@ -0,0 +1,78 @@
+/* getOffset.java -- some checks for the getOffset() methods in the
+ ComponentSampleModel 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.4
+
+package gnu.testlet.java.awt.image.ComponentSampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ComponentSampleModel;
+import java.awt.image.DataBuffer;
+
+public class getOffset implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ testMethod1(harness);
+ testMethod2(harness);
+ }
+
+ public void testMethod1(TestHarness harness)
+ {
+ harness.checkPoint("(int, int)");
+ ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_BYTE, 5,
+ 10, 3, 15, new int[] {0, 1, 2});
+ harness.check(m.getOffset(0, 0), 0);
+ harness.check(m.getOffset(1, 0), 3);
+ harness.check(m.getOffset(2, 0), 6);
+ harness.check(m.getOffset(3, 0), 9);
+ harness.check(m.getOffset(4, 0), 12);
+ harness.check(m.getOffset(5, 0), 15);
+ harness.check(m.getOffset(0, 1), 15);
+ harness.check(m.getOffset(1, 1), 18);
+ harness.check(m.getOffset(2, 1), 21);
+ harness.check(m.getOffset(3, 1), 24);
+ harness.check(m.getOffset(4, 1), 27);
+ harness.check(m.getOffset(5, 1), 30);
+ }
+
+ public void testMethod2(TestHarness harness)
+ {
+ harness.checkPoint("(int, int, int)");
+ ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_BYTE, 5,
+ 10, 3, 15, new int[] {0, 1, 2});
+ harness.check(m.getOffset(0, 0, 1), 1);
+ harness.check(m.getOffset(1, 0, 1), 4);
+ harness.check(m.getOffset(2, 0, 1), 7);
+ harness.check(m.getOffset(3, 0, 1), 10);
+ harness.check(m.getOffset(4, 0, 1), 13);
+ harness.check(m.getOffset(5, 0, 1), 16);
+ harness.check(m.getOffset(0, 1, 1), 16);
+ harness.check(m.getOffset(1, 1, 1), 19);
+ harness.check(m.getOffset(2, 1, 1), 22);
+ harness.check(m.getOffset(3, 1, 1), 25);
+ harness.check(m.getOffset(4, 1, 1), 28);
+ harness.check(m.getOffset(5, 1, 1), 31);
+ }
+}
Index: gnu/testlet/java/awt/image/ComponentSampleModel/getPixel.java
===================================================================
RCS file: gnu/testlet/java/awt/image/ComponentSampleModel/getPixel.java
diff -N gnu/testlet/java/awt/image/ComponentSampleModel/getPixel.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/ComponentSampleModel/getPixel.java 18 Jul 2006 16:49:08 -0000
@@ -0,0 +1,277 @@
+/* getPixel.java -- some checks for the getPixel() methods in the
+ ComponentSampleModel 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.4
+
+package gnu.testlet.java.awt.image.ComponentSampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ComponentSampleModel;
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.util.Arrays;
+
+public class getPixel implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ testMethod1(harness);
+ testMethod2(harness);
+ testMethod3(harness);
+ }
+
+ public void testMethod1(TestHarness harness)
+ {
+ harness.checkPoint("(int, int, int[], DataBuffer)");
+ SampleModel m = new ComponentSampleModel(DataBuffer.TYPE_BYTE, 5, 10,
+ 3, 16, new int[] {0, 2, 1});
+ DataBuffer db = m.createDataBuffer();
+ int[] pixel = new int[3];
+ m.getPixel(1, 2, pixel, db);
+ harness.check(Arrays.equals(pixel, new int[] {0, 0, 0}));
+ m.setPixel(1, 2, new int[] {1, 2, 3}, db);
+ m.getPixel(1, 2, pixel, db);
+ harness.check(Arrays.equals(pixel, new int[] {1, 2, 3}));
+
+ // if the incoming array is null, a new one is created
+ pixel = m.getPixel(1, 2, (int[]) null, db);
+ harness.check(Arrays.equals(pixel, new int[] {1, 2, 3}));
+
+ // try x < 0
+ boolean pass = true;
+ try
+ {
+ m.getPixel(-1, 1, (int[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = false;
+ }
+ harness.check(pass);
+
+ // try x == width
+ pass = true;
+ try
+ {
+ m.getPixel(5, 1, (int[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = false;
+ }
+ harness.check(pass);
+
+ // try y < 0
+ pass = false;
+ try
+ {
+ m.getPixel(1, -1, (int[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try y == height
+ pass = false;
+ try
+ {
+ m.getPixel(1, 10, (int[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try null data buffer
+ pass = false;
+ try
+ {
+ m.getPixel(1, 2, pixel, null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+ public void testMethod2(TestHarness harness)
+ {
+ harness.checkPoint("(int, int, float[], DataBuffer)");
+ SampleModel m = new ComponentSampleModel(DataBuffer.TYPE_BYTE, 5, 10,
+ 3, 16, new int[] {0, 2, 1});
+ DataBuffer db = m.createDataBuffer();
+ float[] pixel = new float[3];
+ m.getPixel(1, 2, pixel, db);
+ harness.check(Arrays.equals(pixel, new float[] {0, 0, 0}));
+ m.setPixel(1, 2, new int[] {1, 2, 3}, db);
+ m.getPixel(1, 2, pixel, db);
+ harness.check(Arrays.equals(pixel, new float[] {1, 2, 3}));
+
+ // if the incoming array is null, a new one is created
+ pixel = m.getPixel(1, 2, (float[]) null, db);
+ harness.check(Arrays.equals(pixel, new float[] {1, 2, 3}));
+
+ // try x < 0
+ boolean pass = false;
+ try
+ {
+ m.getPixel(-1, 1, (float[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try x == width
+ pass = false;
+ try
+ {
+ m.getPixel(5, 1, (float[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try y < 0
+ pass = false;
+ try
+ {
+ m.getPixel(1, -1, (float[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try y == height
+ pass = false;
+ try
+ {
+ m.getPixel(1, 10, (float[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try null data buffer
+ pass = false;
+ try
+ {
+ m.getPixel(1, 2, pixel, null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+ public void testMethod3(TestHarness harness)
+ {
+ harness.checkPoint("(int, int, float[], DataBuffer)");
+ SampleModel m = new ComponentSampleModel(DataBuffer.TYPE_BYTE, 5, 10,
+ 3, 16, new int[] {0, 2, 1});
+ DataBuffer db = m.createDataBuffer();
+ float[] pixel = new float[3];
+ m.getPixel(1, 2, pixel, db);
+ harness.check(Arrays.equals(pixel, new float[] {0, 0, 0}));
+ m.setPixel(1, 2, new int[] {1, 2, 3}, db);
+ m.getPixel(1, 2, pixel, db);
+ harness.check(Arrays.equals(pixel, new float[] {1, 2, 3}));
+
+ // if the incoming array is null, a new one is created
+ pixel = m.getPixel(1, 2, (float[]) null, db);
+ harness.check(Arrays.equals(pixel, new float[] {1, 2, 3}));
+
+ // try x < 0
+ boolean pass = false;
+ try
+ {
+ m.getPixel(-1, 1, (float[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try x == width
+ pass = false;
+ try
+ {
+ m.getPixel(5, 1, (float[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try y < 0
+ pass = false;
+ try
+ {
+ m.getPixel(1, -1, (float[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try y == height
+ pass = false;
+ try
+ {
+ m.getPixel(1, 10, (float[]) null, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try null data buffer
+ pass = false;
+ try
+ {
+ m.getPixel(1, 2, pixel, null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+}
Index: gnu/testlet/java/awt/image/ComponentSampleModel/getSample.java
===================================================================
RCS file: gnu/testlet/java/awt/image/ComponentSampleModel/getSample.java
diff -N gnu/testlet/java/awt/image/ComponentSampleModel/getSample.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/ComponentSampleModel/getSample.java 18 Jul 2006 16:49:08 -0000
@@ -0,0 +1,96 @@
+/* getSample.java -- some checks for the getSample() method in the
+ ComponentSampleModel 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.4
+
+package gnu.testlet.java.awt.image.ComponentSampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ComponentSampleModel;
+import java.awt.image.DataBuffer;
+
+public class getSample implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_BYTE, 5,
+ 10, 3, 16, new int[] {0, 1, 2});
+ DataBuffer db = m.createDataBuffer();
+ harness.check(db.getNumBanks(), 1);
+ db.setElem(0, 16, 0xAA);
+ db.setElem(0, 17, 0xBB);
+ db.setElem(0, 18, 0xCC);
+ harness.check(m.getSample(0, 1, 0, db), 0xAA);
+ harness.check(m.getSample(0, 1, 1, db), 0xBB);
+ harness.check(m.getSample(0, 1, 2, db), 0xCC);
+
+ // try negative x
+ boolean pass = false;
+ try
+ {
+ m.getSample(-1, 1, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try x == width
+ pass = false;
+ try
+ {
+ m.getSample(5, 0, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try negative y
+ pass = false;
+ try
+ {
+ m.getSample(1, -1, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try y == height
+ pass = false;
+ try
+ {
+ m.getSample(0, 10, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+}
Index: gnu/testlet/java/awt/image/ComponentSampleModel/getSampleDouble.java
===================================================================
RCS file: gnu/testlet/java/awt/image/ComponentSampleModel/getSampleDouble.java
diff -N gnu/testlet/java/awt/image/ComponentSampleModel/getSampleDouble.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/ComponentSampleModel/getSampleDouble.java 18 Jul 2006 16:49:08 -0000
@@ -0,0 +1,96 @@
+/* getSampleDouble.java -- some checks for the getSampleDouble() method in the
+ ComponentSampleModel 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.4
+
+package gnu.testlet.java.awt.image.ComponentSampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ComponentSampleModel;
+import java.awt.image.DataBuffer;
+
+public class getSampleDouble implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_BYTE, 5,
+ 10, 3, 16, new int[] {0, 1, 2});
+ DataBuffer db = m.createDataBuffer();
+ harness.check(db.getNumBanks(), 1);
+ db.setElem(0, 16, 0xAA);
+ db.setElem(0, 17, 0xBB);
+ db.setElem(0, 18, 0xCC);
+ harness.check(m.getSampleDouble(0, 1, 0, db), 0xAA);
+ harness.check(m.getSampleDouble(0, 1, 1, db), 0xBB);
+ harness.check(m.getSampleDouble(0, 1, 2, db), 0xCC);
+
+ // try negative x
+ boolean pass = false;
+ try
+ {
+ m.getSampleDouble(-1, 1, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try x == width
+ pass = false;
+ try
+ {
+ m.getSampleDouble(5, 0, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try negative y
+ pass = false;
+ try
+ {
+ m.getSampleDouble(1, -1, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try y == height
+ pass = false;
+ try
+ {
+ m.getSampleDouble(0, 10, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+}
Index: gnu/testlet/java/awt/image/ComponentSampleModel/getSampleFloat.java
===================================================================
RCS file: gnu/testlet/java/awt/image/ComponentSampleModel/getSampleFloat.java
diff -N gnu/testlet/java/awt/image/ComponentSampleModel/getSampleFloat.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/ComponentSampleModel/getSampleFloat.java 18 Jul 2006 16:49:08 -0000
@@ -0,0 +1,96 @@
+/* getSampleFloat.java -- some checks for the getSampleFloat() method in the
+ ComponentSampleModel 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.4
+
+package gnu.testlet.java.awt.image.ComponentSampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ComponentSampleModel;
+import java.awt.image.DataBuffer;
+
+public class getSampleFloat implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_BYTE, 5,
+ 10, 3, 16, new int[] {0, 1, 2});
+ DataBuffer db = m.createDataBuffer();
+ harness.check(db.getNumBanks(), 1);
+ db.setElem(0, 16, 0xAA);
+ db.setElem(0, 17, 0xBB);
+ db.setElem(0, 18, 0xCC);
+ harness.check(m.getSampleFloat(0, 1, 0, db), 0xAA);
+ harness.check(m.getSampleFloat(0, 1, 1, db), 0xBB);
+ harness.check(m.getSampleFloat(0, 1, 2, db), 0xCC);
+
+ // try negative x
+ boolean pass = false;
+ try
+ {
+ m.getSampleFloat(-1, 1, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try x == width
+ pass = false;
+ try
+ {
+ m.getSampleFloat(5, 0, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try negative y
+ pass = false;
+ try
+ {
+ m.getSampleFloat(1, -1, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try y == height
+ pass = false;
+ try
+ {
+ m.getSampleFloat(0, 10, 0, db);
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+}
Index: gnu/testlet/java/awt/image/LookupOp/constructor.java
===================================================================
RCS file: gnu/testlet/java/awt/image/LookupOp/constructor.java
diff -N gnu/testlet/java/awt/image/LookupOp/constructor.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/LookupOp/constructor.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,49 @@
+/* constructor.java -- some checks for the constructor in the LookupOp 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.4
+
+package gnu.testlet.java.awt.image.LookupOp;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.RenderingHints;
+import java.awt.image.ByteLookupTable;
+import java.awt.image.LookupOp;
+
+public class constructor implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
+ ByteLookupTable t = new ByteLookupTable(0, bytes);
+ RenderingHints r = new RenderingHints(RenderingHints.KEY_COLOR_RENDERING,
+ RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ LookupOp op = new LookupOp(t, r);
+ harness.check(op.getTable() == t);
+ harness.check(op.getRenderingHints() == r);
+
+ // try null RenderingHints
+ op = new LookupOp(t, null);
+ harness.check(op.getRenderingHints(), null);
+ }
+}
Index: gnu/testlet/java/awt/image/LookupOp/createCompatibleDestRaster.java
===================================================================
RCS file: gnu/testlet/java/awt/image/LookupOp/createCompatibleDestRaster.java
diff -N gnu/testlet/java/awt/image/LookupOp/createCompatibleDestRaster.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/LookupOp/createCompatibleDestRaster.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,63 @@
+/* createCompatibleDestRaster.java -- some checks for the
+ createCompatibleDestRaster() method in the LookupOp 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.4
+
+package gnu.testlet.java.awt.image.LookupOp;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ByteLookupTable;
+import java.awt.image.DataBuffer;
+import java.awt.image.LookupOp;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.Raster;
+
+public class createCompatibleDestRaster implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
+ ByteLookupTable t = new ByteLookupTable(0, bytes);
+ LookupOp op = new LookupOp(t, null);
+ Raster raster = Raster.createWritableRaster(
+ new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 20, 8), null);
+ Raster dest = op.createCompatibleDestRaster(raster);
+ harness.check(dest.getWidth(), 10);
+ harness.check(dest.getHeight(), 20);
+ harness.check(dest.getNumBands(), 1);
+ harness.check(dest.getSampleModel() instanceof MultiPixelPackedSampleModel);
+
+ // try null argument
+ boolean pass = false;
+ try
+ {
+ op.createCompatibleDestRaster(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+}
Index: gnu/testlet/java/awt/image/LookupOp/getBounds2D.java
===================================================================
RCS file: gnu/testlet/java/awt/image/LookupOp/getBounds2D.java
diff -N gnu/testlet/java/awt/image/LookupOp/getBounds2D.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/LookupOp/getBounds2D.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,96 @@
+/* getBounds2D.java -- some checks for the getBounds2D() methods in the
+ LookupOp 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.4
+
+package gnu.testlet.java.awt.image.LookupOp;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.awt.image.ByteLookupTable;
+import java.awt.image.DataBuffer;
+import java.awt.image.LookupOp;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.Raster;
+
+public class getBounds2D implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ testMethod1(harness);
+ testMethod2(harness);
+ }
+
+ public void testMethod1(TestHarness harness)
+ {
+ harness.checkPoint("(BufferedImage)");
+ BufferedImage image = new BufferedImage(10, 20,
+ BufferedImage.TYPE_INT_ARGB);
+ byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
+ ByteLookupTable t = new ByteLookupTable(0, bytes);
+ LookupOp op = new LookupOp(t, null);
+ Rectangle2D bounds = op.getBounds2D(image);
+ harness.check(bounds.getWidth(), 10);
+ harness.check(bounds.getHeight(), 20);
+
+ // try null argument
+ boolean pass = false;
+ try
+ {
+ op.getBounds2D((BufferedImage) null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+ public void testMethod2(TestHarness harness)
+ {
+ harness.checkPoint("(Raster)");
+ byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
+ ByteLookupTable t = new ByteLookupTable(0, bytes);
+ LookupOp op = new LookupOp(t, null);
+ Raster raster = Raster.createWritableRaster(
+ new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 20, 8),
+ null);
+ Rectangle2D bounds = op.getBounds2D(raster);
+ harness.check(bounds.getWidth(), 10);
+ harness.check(bounds.getHeight(), 20);
+
+ // try null argument
+ boolean pass = false;
+ try
+ {
+ op.getBounds2D((Raster) null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+}
Index: gnu/testlet/java/awt/image/LookupOp/getPoint2D.java
===================================================================
RCS file: gnu/testlet/java/awt/image/LookupOp/getPoint2D.java
diff -N gnu/testlet/java/awt/image/LookupOp/getPoint2D.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/LookupOp/getPoint2D.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,58 @@
+/* getPoint2D.java -- some checks for the getPoint2D() method in the LookupOp
+ 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.4
+
+package gnu.testlet.java.awt.image.LookupOp;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.geom.Point2D;
+import java.awt.image.ByteLookupTable;
+import java.awt.image.LookupOp;
+
+public class getPoint2D implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
+ ByteLookupTable t = new ByteLookupTable(0, bytes);
+ LookupOp op = new LookupOp(t, null);
+ Point2D p = new Point2D.Double(1.0, 2.0);
+ Point2D pp = new Point2D.Double();
+ Point2D p1 = op.getPoint2D(p, pp);
+ harness.check(p1, p);
+ harness.check(p1 == pp);
+ harness.check(p1 != p);
+
+ // try null dest
+ p1 = op.getPoint2D(p, null);
+ harness.check(p1, p);
+ harness.check(p1 != p);
+
+ // try src == dst
+ p1 = op.getPoint2D(p, p);
+ harness.check(p1, p);
+ harness.check(p1 == p);
+ }
+}
Index: gnu/testlet/java/awt/image/LookupOp/getRenderingHints.java
===================================================================
RCS file: gnu/testlet/java/awt/image/LookupOp/getRenderingHints.java
diff -N gnu/testlet/java/awt/image/LookupOp/getRenderingHints.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/LookupOp/getRenderingHints.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,47 @@
+/* getRenderingHints.java -- some checks for the getRenderingHints() method
+ in the LookupOp 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.4
+
+package gnu.testlet.java.awt.image.LookupOp;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.RenderingHints;
+import java.awt.image.ByteLookupTable;
+import java.awt.image.LookupOp;
+
+public class getRenderingHints implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
+ ByteLookupTable t = new ByteLookupTable(0, bytes);
+ RenderingHints r = new RenderingHints(RenderingHints.KEY_COLOR_RENDERING,
+ RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ LookupOp op = new LookupOp(t, r);
+ harness.check(op.getRenderingHints() == r);
+ op = new LookupOp(t, null);
+ harness.check(op.getRenderingHints() == null);
+ }
+}
Index: gnu/testlet/java/awt/image/LookupOp/getTable.java
===================================================================
RCS file: gnu/testlet/java/awt/image/LookupOp/getTable.java
diff -N gnu/testlet/java/awt/image/LookupOp/getTable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/LookupOp/getTable.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,41 @@
+/* getTable.java -- some checks for the getTable() method in the LookupOp 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.4
+
+package gnu.testlet.java.awt.image.LookupOp;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ByteLookupTable;
+import java.awt.image.LookupOp;
+
+public class getTable implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ byte[] bytes = new byte[] {(byte) 0xAA, (byte) 0xBB};
+ ByteLookupTable t = new ByteLookupTable(0, bytes);
+ LookupOp op = new LookupOp(t, null);
+ harness.check(op.getTable() == t);
+ }
+}
Index: gnu/testlet/java/awt/image/LookupTable/MyLookupTable.java
===================================================================
RCS file: gnu/testlet/java/awt/image/LookupTable/MyLookupTable.java
diff -N gnu/testlet/java/awt/image/LookupTable/MyLookupTable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/LookupTable/MyLookupTable.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,40 @@
+/* MyLookupTable.java -- a utility 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.4
+
+package gnu.testlet.java.awt.image.LookupTable;
+
+import java.awt.image.LookupTable;
+
+public class MyLookupTable extends LookupTable
+{
+ public MyLookupTable(int offset, int numComponents)
+ {
+ super(offset, numComponents);
+ }
+
+ public int[] lookupPixel(int[] src, int[] dest)
+ {
+ return null;
+ }
+
+}
Index: gnu/testlet/java/awt/image/LookupTable/constructor.java
===================================================================
RCS file: gnu/testlet/java/awt/image/LookupTable/constructor.java
diff -N gnu/testlet/java/awt/image/LookupTable/constructor.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/LookupTable/constructor.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,64 @@
+/* constructors.java -- some checks for the constructor in the LookupTable
+ 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.4
+
+package gnu.testlet.java.awt.image.LookupTable;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.LookupTable;
+
+public class constructor implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ LookupTable t = new MyLookupTable(1, 2);
+ harness.check(t.getOffset(), 1);
+ harness.check(t.getNumComponents(), 2);
+
+ // try negative offset
+ boolean pass = false;
+ try
+ {
+ t = new MyLookupTable(-1, 2);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try zero components
+ pass = false;
+ try
+ {
+ t = new MyLookupTable(1, 0);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+}
Index: gnu/testlet/java/awt/image/LookupTable/getNumComponents.java
===================================================================
RCS file: gnu/testlet/java/awt/image/LookupTable/getNumComponents.java
diff -N gnu/testlet/java/awt/image/LookupTable/getNumComponents.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/LookupTable/getNumComponents.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,40 @@
+/* getNumComponents.java -- some checks for the getNumComponents() method
+ in the LookupTable 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.4
+
+package gnu.testlet.java.awt.image.LookupTable;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ByteLookupTable;
+
+public class getNumComponents implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ ByteLookupTable t = new ByteLookupTable(0, new byte[] {(byte) 0xAA,
+ (byte) 0xBB});
+ harness.check(t.getNumComponents(), 1);
+ }
+}
Index: gnu/testlet/java/awt/image/LookupTable/getOffset.java
===================================================================
RCS file: gnu/testlet/java/awt/image/LookupTable/getOffset.java
diff -N gnu/testlet/java/awt/image/LookupTable/getOffset.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/LookupTable/getOffset.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,40 @@
+/* getOffset.java -- some checks for the getOffset() method in the LookupTable
+ 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.4
+
+package gnu.testlet.java.awt.image.LookupTable;
+
+import gnu.testlet.TestHarness;
+
+import java.awt.image.ByteLookupTable;
+
+public class getOffset
+{
+ public void test(TestHarness harness)
+ {
+ ByteLookupTable t = new ByteLookupTable(99, new byte[] {(byte) 0xAA,
+ (byte) 0xBB});
+ harness.check(t.getOffset(), 99);
+ }
+
+}
Index: gnu/testlet/java/awt/image/ShortLookupTable/constructors.java
===================================================================
RCS file: gnu/testlet/java/awt/image/ShortLookupTable/constructors.java
diff -N gnu/testlet/java/awt/image/ShortLookupTable/constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/ShortLookupTable/constructors.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,115 @@
+/* constructors.java -- some checks for the constructors in the ShortLookupTable
+ 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.4
+
+package gnu.testlet.java.awt.image.ShortLookupTable;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ShortLookupTable;
+
+public class constructors implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ testConstructor1(harness);
+ testConstructor2(harness);
+ }
+
+ public void testConstructor1(TestHarness harness)
+ {
+ harness.checkPoint("(int, byte[])");
+ short[] shorts = new short[] {0xAA, 0xBB};
+ ShortLookupTable t = new ShortLookupTable(7, shorts);
+ harness.check(t.getOffset(), 7);
+ harness.check(t.getNumComponents(), 1);
+ short[][] table = t.getTable();
+ harness.check(table.length, 1);
+ harness.check(table[0] == shorts);
+
+ // try negative offset
+ boolean pass = false;
+ try
+ {
+ t = new ShortLookupTable(-1, shorts);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try null data
+ pass = false;
+ try
+ {
+ t = new ShortLookupTable(0, (short[]) null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+ public void testConstructor2(TestHarness harness)
+ {
+ harness.checkPoint("(int, byte[][])");
+ short[] shortsA = new short[] {0xAA, 0xBB, 0xCC};
+ short[] shortsB = new short[] {0xDD, 0xEE, 0xFF};
+ short[][] shorts = new short[][] { shortsA, shortsB };
+ ShortLookupTable t = new ShortLookupTable(3, shorts);
+ harness.check(t.getOffset(), 3);
+ harness.check(t.getNumComponents(), 2);
+ short[][] table = t.getTable();
+ harness.check(table.length, 2);
+ harness.check(table[0] == shortsA);
+ harness.check(table[1] == shortsB);
+ harness.check(table != shorts);
+
+ // try negative offset
+ boolean pass = false;
+ try
+ {
+ t = new ShortLookupTable(-1, shorts);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ // try null data
+ pass = false;
+ try
+ {
+ t = new ShortLookupTable(0, (short[][]) null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+}
Index: gnu/testlet/java/awt/image/ShortLookupTable/getTable.java
===================================================================
RCS file: gnu/testlet/java/awt/image/ShortLookupTable/getTable.java
diff -N gnu/testlet/java/awt/image/ShortLookupTable/getTable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/ShortLookupTable/getTable.java 18 Jul 2006 16:49:09 -0000
@@ -0,0 +1,66 @@
+/* getTable.java -- some checks for the getLookUpTable() method in the
+ ShortLookupTable 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.4
+
+package gnu.testlet.java.awt.image.ShortLookupTable;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.ShortLookupTable;
+
+public class getTable implements Testlet
+{
+ public void test(TestHarness harness)
+ {
+ test1(harness);
+ test2(harness);
+ }
+
+ public void test1(TestHarness harness)
+ {
+ harness.checkPoint("test1()");
+ short[] shorts = new short[] {0xAA, 0xBB};
+ ShortLookupTable t = new ShortLookupTable(7, shorts);
+ short[][] table = t.getTable();
+ harness.check(table.length, 1);
+ harness.check(table[0] == shorts);
+ harness.check(t.getTable() == t.getTable());
+ }
+
+ public void test2(TestHarness harness)
+ {
+ harness.checkPoint("test2()");
+ short[] shortsA = new short[] {0xAA, 0xBB, 0xCC};
+ short[] shortsB = new short[] {0xDD, 0xEE, 0xFF};
+ short[][] shorts = new short[][] { shortsA, shortsB };
+ ShortLookupTable t = new ShortLookupTable(3, shorts);
+ short[][] table = t.getTable();
+ harness.check(table.length, 2);
+ harness.check(table[0] == shortsA);
+ harness.check(table[1] == shortsB);
+ harness.check(table != shorts);
+ harness.check(t.getTable() == t.getTable());
+ }
+
+}