This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: SampleModel - new tests


This patch (committed) adds some tests for the SampleModel class:

2006-07-13 David Gilbert <david.gilbert@object-refinery.com>

   * gnu/testlet/java/awt/image/SampleModel/createDataBuffer.java:
   New file,
   * gnu/testlet/java/awt/image/SampleModel/getPixel.java: Likewise,
   * gnu/testlet/java/awt/image/SampleModel/getPixels.java: Likewise,
   * gnu/testlet/java/awt/image/SampleModel/getSample.java: Likewise,
   * gnu/testlet/java/awt/image/SampleModel/getSampleDouble.java: Likewise,
   * gnu/testlet/java/awt/image/SampleModel/getSampleFloat.java: Likewise,
   * gnu/testlet/java/awt/image/SampleModel/getSamples.java: Likewise,
   * gnu/testlet/java/awt/image/SampleModel/getSampleSize.java: Likewise,
   * gnu/testlet/java/awt/image/SampleModel/setPixel.java: Likewise,
   * gnu/testlet/java/awt/image/SampleModel/setPixels.java: Likewise,
   * gnu/testlet/java/awt/image/SampleModel/setSample.java: Likewise,
   * gnu/testlet/java/awt/image/SampleModel/setSamples.java: Likewise.

Regards,

Dave
Index: gnu/testlet/java/awt/image/SampleModel/createDataBuffer.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/createDataBuffer.java
diff -N gnu/testlet/java/awt/image/SampleModel/createDataBuffer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/createDataBuffer.java	13 Jul 2006 11:22:52 -0000
@@ -0,0 +1,48 @@
+/* createDataBuffer.java -- some checks for the createDataBuffer() method in 
+       the SampleModel 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.SampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+
+public class createDataBuffer implements Testlet 
+{
+    
+  public void test(TestHarness harness)
+  {
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    harness.check(db.getDataType(), DataBuffer.TYPE_BYTE);
+    harness.check(db.getNumBanks(), 1);
+    harness.check(db.getSize(), 200);
+    harness.check(db.getOffsets()[0], 0);
+  }
+
+}
Index: gnu/testlet/java/awt/image/SampleModel/getPixel.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/getPixel.java
diff -N gnu/testlet/java/awt/image/SampleModel/getPixel.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/getPixel.java	13 Jul 2006 11:22:52 -0000
@@ -0,0 +1,133 @@
+/* getPixel.java -- some checks for the getPixel() methods in the SampleModel
+       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.SampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+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 SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    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 null data buffer
+    boolean 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 SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    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 null data buffer
+    boolean 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, double[], DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    double[] pixel = new double[3];
+    m.getPixel(1, 2, pixel, db);
+    harness.check(Arrays.equals(pixel, new double[] {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 double[] {1, 2, 3}));
+    
+    // if the incoming array is null, a new one is created
+    pixel = m.getPixel(1, 2, (double[]) null, db);
+    harness.check(Arrays.equals(pixel, new double[] {1, 2, 3}));
+    
+    // try null data buffer
+    boolean pass = false;
+    try
+    {
+      m.getPixel(1, 2, pixel, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: gnu/testlet/java/awt/image/SampleModel/getPixels.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/getPixels.java
diff -N gnu/testlet/java/awt/image/SampleModel/getPixels.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/getPixels.java	13 Jul 2006 11:22:52 -0000
@@ -0,0 +1,145 @@
+/* getPixels.java -- some checks for the getPixels() methods in the SampleModel
+       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.SampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.util.Arrays;
+
+public class getPixels implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    testMethod1(harness);
+    testMethod2(harness);
+    testMethod3(harness);
+  }
+  
+  public void testMethod1(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, int[], DataBuffer)");
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    int[] pixel = new int[18];
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+            0, 0, 0, 0, 0, 0, 0, 0}));
+    m.setPixels(1, 2, 2, 3, new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
+            13, 14, 15, 16, 17, 18}, db);
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new int[] {1, 2, 3, 4, 5, 2, 7, 0, 1, 
+            2, 3, 0, 5, 6, 3, 0, 1, 2}));
+    
+    // if the incoming array is null, a new one is created
+    pixel = m.getPixels(1, 2, 2, 3, (int[]) null, db);
+    harness.check(Arrays.equals(pixel, new int[] {1, 2, 3, 4, 5, 2, 7, 0, 1, 
+            2, 3, 0, 5, 6, 3, 0, 1, 2}));
+    
+    // try null data buffer
+    boolean pass = false;
+    try
+    {
+      m.getPixels(1, 2, 2, 3, pixel, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+  
+  public void testMethod2(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, float[], DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    float[] pixel = new float[18];
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new float[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 
+            0, 0, 0, 0, 0, 0, 0, 0, 0}));
+    m.setPixels(1, 2, 2, 3, new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
+            13, 14, 15, 16, 17, 18}, db);
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new float[] {1, 2, 3, 4, 5, 2, 7, 0, 1, 
+            2, 3, 0, 5, 6, 3, 0, 1, 2}));
+    
+    // if the incoming array is null, a new one is created
+    pixel = m.getPixels(1, 2, 2, 3, (float[]) null, db);
+    harness.check(Arrays.equals(pixel, new float[] {1, 2, 3, 4, 5, 2, 7, 0, 1, 
+            2, 3, 0, 5, 6, 3, 0, 1, 2}));
+    
+    // try null data buffer
+    boolean pass = false;
+    try
+    {
+      m.getPixels(1, 2, 2, 3, pixel, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  public void testMethod3(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, double[], DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    double[] pixel = new double[18];
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new double[] {0, 0, 0, 0, 0, 0, 0, 0, 0,
+            0, 0, 0, 0, 0, 0, 0, 0, 0}));
+    m.setPixels(1, 2, 2, 3, new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
+            13, 14, 15, 16, 17, 18}, db);
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new double[] {1, 2, 3, 4, 5, 2, 7, 0, 1, 
+            2, 3, 0, 5, 6, 3, 0, 1, 2}));
+    
+    // if the incoming array is null, a new one is created
+    pixel = m.getPixels(1, 2, 2, 3, (double[]) null, db);
+    harness.check(Arrays.equals(pixel, new double[] {1, 2, 3, 4, 5, 2, 7, 0, 1, 
+            2, 3, 0, 5, 6, 3, 0, 1, 2}));
+    
+    // try null data buffer
+    boolean pass = false;
+    try
+    {
+      m.getPixels(1, 2, 2, 3, pixel, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: gnu/testlet/java/awt/image/SampleModel/getSample.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/getSample.java
diff -N gnu/testlet/java/awt/image/SampleModel/getSample.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/getSample.java	13 Jul 2006 11:22:52 -0000
@@ -0,0 +1,86 @@
+/* getSample.java -- some checks for the getSample() method in the SampleModel
+       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.SampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+
+public class getSample implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, DataBuffer)");
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    harness.check(m.getSample(1, 2, 0, db), 0);
+    harness.check(m.getSample(1, 2, 1, db), 0);
+    harness.check(m.getSample(1, 2, 2, db), 0);
+    m.setPixel(1, 2, new int[] {1, 2, 3}, db);
+    harness.check(m.getSample(1, 2, 0, db), 1);
+    harness.check(m.getSample(1, 2, 1, db), 2);
+    harness.check(m.getSample(1, 2, 2, db), 3);
+    
+    // try band out of range
+    boolean pass = false;
+    try
+    {
+      m.getSample(1, 2, -1, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(true);
+    
+    pass = false;
+    try
+    {
+      m.getSample(1, 2, 3, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(true);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.getSample(1, 2, 0, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+  
+}
Index: gnu/testlet/java/awt/image/SampleModel/getSampleDouble.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/getSampleDouble.java
diff -N gnu/testlet/java/awt/image/SampleModel/getSampleDouble.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/getSampleDouble.java	13 Jul 2006 11:22:52 -0000
@@ -0,0 +1,86 @@
+/* getSampleDouble.java -- some checks for the getSampleDouble() method in the 
+       SampleModel 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.SampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+
+public class getSampleDouble implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, DataBuffer)");
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    harness.check(m.getSampleDouble(1, 2, 0, db), 0);
+    harness.check(m.getSampleDouble(1, 2, 1, db), 0);
+    harness.check(m.getSampleDouble(1, 2, 2, db), 0);
+    m.setPixel(1, 2, new int[] {1, 2, 3}, db);
+    harness.check(m.getSampleDouble(1, 2, 0, db), 1);
+    harness.check(m.getSampleDouble(1, 2, 1, db), 2);
+    harness.check(m.getSampleDouble(1, 2, 2, db), 3);
+    
+    // try band out of range
+    boolean pass = false;
+    try
+    {
+      m.getSampleDouble(1, 2, -1, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(true);
+    
+    pass = false;
+    try
+    {
+      m.getSampleDouble(1, 2, 3, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(true);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.getSampleDouble(1, 2, 0, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+  
+}
Index: gnu/testlet/java/awt/image/SampleModel/getSampleFloat.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/getSampleFloat.java
diff -N gnu/testlet/java/awt/image/SampleModel/getSampleFloat.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/getSampleFloat.java	13 Jul 2006 11:22:52 -0000
@@ -0,0 +1,86 @@
+/* getSampleFloat.java -- some checks for the getSampleFloat() method in the 
+       SampleModel 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.SampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+
+public class getSampleFloat implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, DataBuffer)");
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    harness.check(m.getSampleFloat(1, 2, 0, db), 0);
+    harness.check(m.getSampleFloat(1, 2, 1, db), 0);
+    harness.check(m.getSampleFloat(1, 2, 2, db), 0);
+    m.setPixel(1, 2, new int[] {1, 2, 3}, db);
+    harness.check(m.getSampleFloat(1, 2, 0, db), 1);
+    harness.check(m.getSampleFloat(1, 2, 1, db), 2);
+    harness.check(m.getSampleFloat(1, 2, 2, db), 3);
+    
+    // try band out of range
+    boolean pass = false;
+    try
+    {
+      m.getSampleFloat(1, 2, -1, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(true);
+    
+    pass = false;
+    try
+    {
+      m.getSampleFloat(1, 2, 3, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(true);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.getSampleFloat(1, 2, 0, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+  
+}
Index: gnu/testlet/java/awt/image/SampleModel/getSampleSize.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/getSampleSize.java
diff -N gnu/testlet/java/awt/image/SampleModel/getSampleSize.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/getSampleSize.java	13 Jul 2006 11:22:52 -0000
@@ -0,0 +1,85 @@
+/* getSampleSize.java -- some checks for the getSampleSize() methods in the 
+       SampleModel 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.SampleModel;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class getSampleSize implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    test1(harness);
+    test2(harness);
+  }
+  
+  public void test1(TestHarness harness) 
+  {
+    harness.checkPoint("()");
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    int[] s = m.getSampleSize();
+    harness.check(s.length, 3);
+    harness.check(s[0], 3);    
+    harness.check(s[1], 3);
+    harness.check(s[2], 2);
+  }
+  
+  public void test2(TestHarness harness) 
+  {
+    harness.checkPoint("(int)");
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    harness.check(m.getSampleSize(0), 3);
+    harness.check(m.getSampleSize(1), 3);
+    harness.check(m.getSampleSize(2), 2);
+    
+    boolean pass = false;
+    try
+    {
+      m.getSampleSize(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try
+    {
+      m.getSampleSize(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: gnu/testlet/java/awt/image/SampleModel/getSamples.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/getSamples.java
diff -N gnu/testlet/java/awt/image/SampleModel/getSamples.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/getSamples.java	13 Jul 2006 11:22:52 -0000
@@ -0,0 +1,184 @@
+/* getSamples.java -- some checks for the getSamples() methods in the 
+       SampleModel 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.SampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.util.Arrays;
+
+public class getSamples implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    testMethod1(harness);
+    testMethod2(harness);
+    testMethod3(harness);
+  }
+  
+  public void testMethod1(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, int, int[], DataBuffer)");
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    int[] samples = new int[6];
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new int[] {0, 0, 0, 0, 0, 0}));
+    m.setPixels(1, 2, 2, 3, new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
+            13, 14, 15, 16, 17, 18}, db);
+    m.getSamples(1, 2, 2, 3, 0, samples, db);
+    harness.check(Arrays.equals(samples, new int[] {1, 4, 7, 2, 5, 0}));
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new int[] {2, 5, 0, 3, 6, 1}));
+    m.getSamples(1, 2, 2, 3, 2, samples, db);
+    harness.check(Arrays.equals(samples, new int[] {3, 2, 1, 0, 3, 2}));
+    
+    // if the incoming array is null, a new one is created
+    samples = m.getSamples(1, 2, 2, 3, 2, (int[]) null, db);
+    harness.check(Arrays.equals(samples, new int[] {3, 2, 1, 0, 3, 2}));
+    
+    // try invalid band
+    boolean pass = false;
+    try
+    {
+      m.getSamples(1, 2, 2, 3, 3, samples, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.getSamples(1, 2, 2, 3, 0, samples, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+  
+  public void testMethod2(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, int, float[], DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    float[] samples = new float[6];
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new float[] {0, 0, 0, 0, 0, 0}));
+    m.setPixels(1, 2, 2, 3, new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
+            13, 14, 15, 16, 17, 18}, db);
+    m.getSamples(1, 2, 2, 3, 0, samples, db);
+    harness.check(Arrays.equals(samples, new float[] {1, 4, 7, 2, 5, 0}));
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new float[] {2, 5, 0, 3, 6, 1}));
+    m.getSamples(1, 2, 2, 3, 2, samples, db);
+    harness.check(Arrays.equals(samples, new float[] {3, 2, 1, 0, 3, 2}));
+    
+    // if the incoming array is null, a new one is created
+    samples = m.getSamples(1, 2, 2, 3, 2, (float[]) null, db);
+    harness.check(Arrays.equals(samples, new float[] {3, 2, 1, 0, 3, 2}));
+    
+    // try invalid band
+    boolean pass = false;
+    try
+    {
+      m.getSamples(1, 2, 2, 3, 3, samples, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.getSamples(1, 2, 2, 3, 0, samples, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  public void testMethod3(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, int, double[], DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    double[] samples = new double[6];
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new double[] {0, 0, 0, 0, 0, 0}));
+    m.setPixels(1, 2, 2, 3, new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
+            13, 14, 15, 16, 17, 18}, db);
+    m.getSamples(1, 2, 2, 3, 0, samples, db);
+    harness.check(Arrays.equals(samples, new double[] {1, 4, 7, 2, 5, 0}));
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new double[] {2, 5, 0, 3, 6, 1}));
+    m.getSamples(1, 2, 2, 3, 2, samples, db);
+    harness.check(Arrays.equals(samples, new double[] {3, 2, 1, 0, 3, 2}));
+    
+    // if the incoming array is null, a new one is created
+    samples = m.getSamples(1, 2, 2, 3, 2, (double[]) null, db);
+    harness.check(Arrays.equals(samples, new double[] {3, 2, 1, 0, 3, 2}));
+    
+    // try invalid band
+    boolean pass = false;
+    try
+    {
+      m.getSamples(1, 2, 2, 3, 3, samples, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.getSamples(1, 2, 2, 3, 0, samples, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: gnu/testlet/java/awt/image/SampleModel/setPixel.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/setPixel.java
diff -N gnu/testlet/java/awt/image/SampleModel/setPixel.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/setPixel.java	13 Jul 2006 11:22:53 -0000
@@ -0,0 +1,157 @@
+/* setPixel.java -- some checks for the setPixel() methods in the SampleModel
+       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.SampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.util.Arrays;
+
+public class setPixel 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 SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    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}));
+    
+    // try null array
+    boolean pass = true;
+    try
+    {
+      m.setPixel(1, 2, (int[]) null, db);
+    }
+    catch (NullPointerException e)
+    {
+        pass = true;
+    }
+    harness.check(pass);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.setPixel(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 SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    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 float[] {1, 2, 3}, db);
+    m.getPixel(1, 2, pixel, db);
+    harness.check(Arrays.equals(pixel, new float[] {1, 2, 3}));
+    
+    // try null array
+    boolean pass = true;
+    try
+    {
+      m.setPixel(1, 2, (float[]) null, db);
+    }
+    catch (NullPointerException e)
+    {
+        pass = true;
+    }
+    harness.check(pass);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.setPixel(1, 2, pixel, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  public void testMethod3(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, double[], DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    double[] pixel = new double[3];
+    m.getPixel(1, 2, pixel, db);
+    harness.check(Arrays.equals(pixel, new double[] {0, 0, 0}));
+    m.setPixel(1, 2, new double[] {1, 2, 3}, db);
+    m.getPixel(1, 2, pixel, db);
+    harness.check(Arrays.equals(pixel, new double[] {1, 2, 3}));
+    
+    // try null array
+    boolean pass = true;
+    try
+    {
+      m.setPixel(1, 2, (double[]) null, db);
+    }
+    catch (NullPointerException e)
+    {
+        pass = true;
+    }
+    harness.check(pass);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.setPixel(1, 2, pixel, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: gnu/testlet/java/awt/image/SampleModel/setPixels.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/setPixels.java
diff -N gnu/testlet/java/awt/image/SampleModel/setPixels.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/setPixels.java	13 Jul 2006 11:22:53 -0000
@@ -0,0 +1,166 @@
+/* setPixels.java -- some checks for the setPixels() methods in the SampleModel
+       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.SampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.util.Arrays;
+
+public class setPixels implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    testMethod1(harness);
+    testMethod2(harness);
+    testMethod3(harness);
+  }
+  
+  public void testMethod1(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, int[], DataBuffer)");
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    int[] pixel = new int[18];
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+            0, 0, 0, 0, 0, 0, 0, 0}));
+    m.setPixels(1, 2, 2, 3, new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
+            13, 14, 15, 16, 17, 18}, db);
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new int[] {1, 2, 3, 4, 5, 2, 7, 0, 1, 
+            2, 3, 0, 5, 6, 3, 0, 1, 2}));
+    
+    // try null pixel data
+    boolean pass = false;
+    try
+    {
+      m.setPixels(1, 2, 2, 3, (int[]) null, db);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.setPixels(1, 2, 2, 3, pixel, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+  
+  public void testMethod2(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, float[], DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    float[] pixel = new float[18];
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new float[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+            0, 0, 0, 0, 0, 0, 0, 0}));
+    m.setPixels(1, 2, 2, 3, new float[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
+            13, 14, 15, 16, 17, 18}, db);
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new float[] {1, 2, 3, 4, 5, 2, 7, 0, 1, 
+            2, 3, 0, 5, 6, 3, 0, 1, 2}));
+    
+    // try null pixel data
+    boolean pass = false;
+    try
+    {
+      m.setPixels(1, 2, 2, 3, (float[]) null, db);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.setPixels(1, 2, 2, 3, pixel, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  public void testMethod3(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, double[], DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    double[] pixel = new double[18];
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new double[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+            0, 0, 0, 0, 0, 0, 0, 0}));
+    m.setPixels(1, 2, 2, 3, new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
+            13, 14, 15, 16, 17, 18}, db);
+    m.getPixels(1, 2, 2, 3, pixel, db);
+    harness.check(Arrays.equals(pixel, new double[] {1, 2, 3, 4, 5, 2, 7, 0, 1, 
+            2, 3, 0, 5, 6, 3, 0, 1, 2}));
+    
+    // try null pixel data
+    boolean pass = false;
+    try
+    {
+      m.setPixels(1, 2, 2, 3, (double[]) null, db);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.setPixels(1, 2, 2, 3, pixel, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: gnu/testlet/java/awt/image/SampleModel/setSample.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/setSample.java
diff -N gnu/testlet/java/awt/image/SampleModel/setSample.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/setSample.java	13 Jul 2006 11:22:53 -0000
@@ -0,0 +1,180 @@
+/* setSample.java -- some checks for the setSample() methods in the SampleModel
+       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.SampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+
+public class setSample implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    testMethod1(harness);
+    testMethod2(harness);
+    testMethod3(harness);
+  }
+  
+  public void testMethod1(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, DataBuffer)");
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    harness.check(m.getSample(1, 2, 0, db), 0);
+    m.setSample(1, 2, 0, 3, db);
+    harness.check(m.getSample(1, 2, 0, db), 3);
+    
+    // try invalid band
+    boolean pass = true;
+    try
+    {
+      m.setSample(1, 2, -1, 3, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+        pass = true;
+    }
+    harness.check(pass);
+    
+    pass = true;
+    try
+    {
+      m.setSample(1, 2, 3, 3, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+        pass = true;
+    }
+    harness.check(pass);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.setSample(1, 2, 2, 3, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+  
+  public void testMethod2(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, float, DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    harness.check(m.getSample(1, 2, 0, db), 0);
+    m.setSample(1, 2, 0, 3f, db);
+    harness.check(m.getSample(1, 2, 0, db), 3);
+    
+    // try invalid band
+    boolean pass = true;
+    try
+    {
+      m.setSample(1, 2, -1, 3f, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+        pass = true;
+    }
+    harness.check(pass);
+    
+    pass = true;
+    try
+    {
+      m.setSample(1, 2, 3, 3f, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+        pass = true;
+    }
+    harness.check(pass);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.setSample(1, 2, 2, 3f, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  public void testMethod3(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, double, DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    harness.check(m.getSample(1, 2, 0, db), 0);
+    m.setSample(1, 2, 0, 3d, db);
+    harness.check(m.getSample(1, 2, 0, db), 3);
+    
+    // try invalid band
+    boolean pass = true;
+    try
+    {
+      m.setSample(1, 2, -1, 3d, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+        pass = true;
+    }
+    harness.check(pass);
+    
+    pass = true;
+    try
+    {
+      m.setSample(1, 2, 3, 3d, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+        pass = true;
+    }
+    harness.check(pass);
+    
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.setSample(1, 2, 2, 3d, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: gnu/testlet/java/awt/image/SampleModel/setSamples.java
===================================================================
RCS file: gnu/testlet/java/awt/image/SampleModel/setSamples.java
diff -N gnu/testlet/java/awt/image/SampleModel/setSamples.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/image/SampleModel/setSamples.java	13 Jul 2006 11:22:53 -0000
@@ -0,0 +1,211 @@
+/* setSamples.java -- some checks for the setSamples() methods in the 
+       SampleModel 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.SampleModel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.util.Arrays;
+
+public class setSamples implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    testMethod1(harness);
+    testMethod2(harness);
+    testMethod3(harness);
+  }
+  
+  public void testMethod1(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, int, int[], DataBuffer)");
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    int[] samples = new int[6];
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new int[] {0, 0, 0, 0, 0, 0}));
+    m.setSamples(1, 2, 2, 3, 0, new int[] {1, 2, 3, 4 ,5 ,6}, db);
+    m.getSamples(1, 2, 2, 3, 0, samples, db);
+    harness.check(Arrays.equals(samples, new int[] {1, 2, 3, 4, 5, 6}));
+    m.setSamples(1, 2, 2, 3, 1, new int[] {7, 8, 9, 10, 11, 12}, db);
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new int[] {7, 0, 1, 2, 3, 4}));
+    m.setSamples(1, 2, 2, 3, 2, new int[] {13, 14, 15, 16, 17, 18}, db);
+    m.getSamples(1, 2, 2, 3, 2, samples, db);
+    harness.check(Arrays.equals(samples, new int[] {1, 2, 3, 0, 1, 2}));
+    
+    // try invalid band
+    boolean pass = false;
+    try
+    {
+      m.setSamples(1, 2, 2, 3, 3, samples, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // try null sample data
+    pass = false;
+    try
+    {
+      m.setSamples(1, 2, 2, 3, 0, (int[]) null, db);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.getSamples(1, 2, 2, 3, 0, samples, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+  
+  public void testMethod2(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, int, float[], DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    float[] samples = new float[6];
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new float[] {0, 0, 0, 0, 0, 0}));
+    m.setSamples(1, 2, 2, 3, 0, new float[] {1, 2, 3, 4 ,5 ,6}, db);
+    m.getSamples(1, 2, 2, 3, 0, samples, db);
+    harness.check(Arrays.equals(samples, new float[] {1, 2, 3, 4, 5, 6}));
+    m.setSamples(1, 2, 2, 3, 1, new float[] {7, 8, 9, 10, 11, 12}, db);
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new float[] {7, 0, 1, 2, 3, 4}));
+    m.setSamples(1, 2, 2, 3, 2, new float[] {13, 14, 15, 16, 17, 18}, db);
+    m.getSamples(1, 2, 2, 3, 2, samples, db);
+    harness.check(Arrays.equals(samples, new float[] {1, 2, 3, 0, 1, 2}));
+    
+    // try invalid band
+    boolean pass = false;
+    try
+    {
+      m.setSamples(1, 2, 2, 3, 3, samples, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // try null sample data
+    pass = false;
+    try
+    {
+      m.setSamples(1, 2, 2, 3, 0, (float[]) null, db);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.getSamples(1, 2, 2, 3, 0, samples, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  public void testMethod3(TestHarness harness)
+  {
+    harness.checkPoint("(int, int, int, int, int, double[], DataBuffer)");     
+    SampleModel m = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE, 10, 
+            20, new int[] { 224, 28, 3 });
+    DataBuffer db = m.createDataBuffer();
+    double[] samples = new double[6];
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new double[] {0, 0, 0, 0, 0, 0}));
+    m.setSamples(1, 2, 2, 3, 0, new double[] {1, 2, 3, 4 ,5 ,6}, db);
+    m.getSamples(1, 2, 2, 3, 0, samples, db);
+    harness.check(Arrays.equals(samples, new double[] {1, 2, 3, 4, 5, 6}));
+    m.setSamples(1, 2, 2, 3, 1, new double[] {7, 8, 9, 10, 11, 12}, db);
+    m.getSamples(1, 2, 2, 3, 1, samples, db);
+    harness.check(Arrays.equals(samples, new double[] {7, 0, 1, 2, 3, 4}));
+    m.setSamples(1, 2, 2, 3, 2, new double[] {13, 14, 15, 16, 17, 18}, db);
+    m.getSamples(1, 2, 2, 3, 2, samples, db);
+    harness.check(Arrays.equals(samples, new double[] {1, 2, 3, 0, 1, 2}));
+    
+    // try invalid band
+    boolean pass = false;
+    try
+    {
+      m.setSamples(1, 2, 2, 3, 3, samples, db);
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // try null sample data
+    pass = false;
+    try
+    {
+      m.setSamples(1, 2, 2, 3, 0, (double[]) null, db);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // try null data buffer
+    pass = false;
+    try
+    {
+      m.getSamples(1, 2, 2, 3, 0, samples, null);
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]