This is the mail archive of the mauve-patches@sources.redhat.com 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]

Re: DataBuffer constructors


On Fri, 2004-08-27 at 20:24, Mark Wielaard wrote:
> Hi,
> 
> On Fri, 2004-08-27 at 14:57, David Gilbert wrote:
> > I'll update all the DataBuffer constructor tests and resubmit them.
> 
> Thanks!

OK, I've updated the constructor tests, plus filled out tests for the
other methods - see attached patches.  I get 14 errors using JamVM 1.1.4
and a very recent CVS version of Classpath and no errors with Sun's JDK
1.4.  See the output below.

> > A much more general question that this case raises for me, though:  when
> > something isn't specified, does it cause any trouble to write checks
> > based on the actual behaviour of Sun's implementation?
> 
> Writing tests for things that are not specified and only happen to work
> with one implementation isn't that useful imho. I would try to find at
> least documentation about the behavior from articles or books real
> programmers use or a (important free software) program/library that
> depends on certain (unspecified) behavior. There are lots of things for
> which we don't have tests yet which are specified exactly which are
> probably more important to write detailed tests for at the moment
> anyway. Adn there is always the chance that the unspecified behavior
> gets reimplemented differently in a later release.

OK.  I've started with the DataBuffer classes (which are not that
interesting) and intend to work my way up the "food chain" to the
BufferedImage class.  I'm sure to find some bugs along the way, but it's
mainly a learning exercise for me.  Anyway, I'm hopeful that the other
classes are better specified.

Regards,
Dave.

P.S.  Here's the output I get from the attached tests:

dgilbert@linux42:~/workspace/mauve> jamvm -cp .
gnu.testlet.SimpleTestHarness -file CurrentTests.txt -debug
FAIL: gnu.testlet.java.awt.image.DataBufferByte.getBankData: uncaught
exception at  number 5
java.lang.NullPointerException
   at gnu.testlet.java.awt.image.DataBufferByte.getBankData.test
(getBankData.java:66)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
FAIL: gnu.testlet.java.awt.image.DataBufferByte.getElem: uncaught
exception at "getElem(int, int)" number 14
java.lang.NullPointerException
   at java.awt.image.DataBufferByte.getElem (DataBufferByte.java:119)
   at gnu.testlet.java.awt.image.DataBufferByte.getElem.testGetElem2
(getElem.java:196)
   at gnu.testlet.java.awt.image.DataBufferByte.getElem.test
(getElem.java:54)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
FAIL: gnu.testlet.java.awt.image.DataBufferDouble.getBankData: uncaught
exception at  number 5
java.lang.NullPointerException
   at gnu.testlet.java.awt.image.DataBufferDouble.getBankData.test
(getBankData.java:66)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
FAIL: gnu.testlet.java.awt.image.DataBufferDouble.getElem: uncaught
exception at "getElem(int, int)" number 14
java.lang.NullPointerException
   at java.awt.image.DataBufferDouble.getElem
(DataBufferDouble.java:122)
   at gnu.testlet.java.awt.image.DataBufferDouble.getElem.testGetElem2
(getElem.java:195)
   at gnu.testlet.java.awt.image.DataBufferDouble.getElem.test
(getElem.java:53)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
FAIL: gnu.testlet.java.awt.image.DataBufferFloat.getBankData: uncaught
exception at  number 5
java.lang.NullPointerException
   at gnu.testlet.java.awt.image.DataBufferFloat.getBankData.test
(getBankData.java:66)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
FAIL: gnu.testlet.java.awt.image.DataBufferFloat.getElem: uncaught
exception at "getElem(int, int)" number 14
java.lang.NullPointerException
   at java.awt.image.DataBufferFloat.getElem (DataBufferFloat.java:120)
   at gnu.testlet.java.awt.image.DataBufferFloat.getElem.testGetElem2
(getElem.java:195)
   at gnu.testlet.java.awt.image.DataBufferFloat.getElem.test
(getElem.java:53)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
FAIL: gnu.testlet.java.awt.image.DataBufferInt.getBankData: uncaught
exception at  number 5
java.lang.NullPointerException
   at gnu.testlet.java.awt.image.DataBufferInt.getBankData.test
(getBankData.java:66)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
FAIL: gnu.testlet.java.awt.image.DataBufferInt.getElem: uncaught
exception at "getElem(int, int)" number 14
java.lang.NullPointerException
   at java.awt.image.DataBufferInt.getElem (DataBufferInt.java:119)
   at gnu.testlet.java.awt.image.DataBufferInt.getElem.testGetElem2
(getElem.java:195)
   at gnu.testlet.java.awt.image.DataBufferInt.getElem.test
(getElem.java:53)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
FAIL: gnu.testlet.java.awt.image.DataBufferShort.getBankData: uncaught
exception at  number 5
java.lang.NullPointerException
   at gnu.testlet.java.awt.image.DataBufferShort.getBankData.test
(getBankData.java:66)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
FAIL: gnu.testlet.java.awt.image.DataBufferShort.getElem: uncaught
exception at "getElem(int, int)" number 14
java.lang.NullPointerException
   at java.awt.image.DataBufferShort.getElem (DataBufferShort.java:118)
   at gnu.testlet.java.awt.image.DataBufferShort.getElem.testGetElem2
(getElem.java:196)
   at gnu.testlet.java.awt.image.DataBufferShort.getElem.test
(getElem.java:54)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
FAIL: gnu.testlet.java.awt.image.DataBufferUShort.constructors:
DataBufferUShort(short[], int) (number 4)
FAIL: gnu.testlet.java.awt.image.DataBufferUShort.constructors:
DataBufferUShort(short[], int, int) (number 4)
FAIL: gnu.testlet.java.awt.image.DataBufferUShort.getBankData: uncaught
exception at  number 5
java.lang.NullPointerException
   at gnu.testlet.java.awt.image.DataBufferUShort.getBankData.test
(getBankData.java:66)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
FAIL: gnu.testlet.java.awt.image.DataBufferUShort.getElem: uncaught
exception at "getElem(int, int)" number 14
java.lang.NullPointerException
   at java.awt.image.DataBufferUShort.getElem
(DataBufferUShort.java:119)
   at gnu.testlet.java.awt.image.DataBufferUShort.getElem.testGetElem2
(getElem.java:195)
   at gnu.testlet.java.awt.image.DataBufferUShort.getElem.test
(getElem.java:53)
   at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:266)
   at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:394)
14 of 703 tests failed


dgilbert@linux42:~/workspace/mauve> java -cp .
gnu.testlet.SimpleTestHarness -file CurrentTests.txt -debug
0 of 733 tests failed



Index: getDataType.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/DataBufferByte/getDataType.java,v
retrieving revision 1.1
diff -u -r1.1 getDataType.java
--- getDataType.java	14 Apr 2004 11:33:35 -0000	1.1
+++ getDataType.java	1 Sep 2004 14:30:45 -0000
@@ -21,8 +21,8 @@
 
 package gnu.testlet.java.awt.image.DataBufferByte;
 
-import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
 
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferByte;
Index: getElem.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/DataBufferByte/getElem.java,v
retrieving revision 1.1
diff -u -r1.1 getElem.java
--- getElem.java	14 Apr 2004 11:33:35 -0000	1.1
+++ getElem.java	1 Sep 2004 14:30:45 -0000
@@ -21,8 +21,8 @@
 
 package gnu.testlet.java.awt.image.DataBufferByte;
 
-import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
 
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferByte;
@@ -48,5 +48,151 @@
     h.check(buf.getElem(0, 1), 256 - 44); // Check #4.
     h.check(buf.getElem(1, 0), 256 - 11); // Check #5.
     h.check(buf.getElem(1, 1), 256 - 22); // Check #6.
+    
+    // new tests added by David Gilbert
+    testGetElem1(h);
+    testGetElem2(h);
+    
+  }
+  
+  private void testGetElem1(TestHarness harness) 
+  {
+    harness.checkPoint("getElem(int)");  
+      
+    // test where supplied array is bigger than 'size'
+    byte[] source = new byte[] {1, 2, 3};
+    DataBufferByte b = new DataBufferByte(source, 2);
+    harness.check(b.getElem(0) == 1);
+    harness.check(b.getElem(1) == 2);
+    harness.check(b.getElem(2) == 3);
+    
+    boolean pass = false;
+    try
+    {
+      b.getElem(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test where offsets are specified
+    source = new byte[] {1, 2, 3, 4};
+    b = new DataBufferByte(source, 2, 1);
+    harness.check(b.getElem(-1) == 1);
+    harness.check(b.getElem(0) == 2);
+    harness.check(b.getElem(1) == 3);
+    harness.check(b.getElem(2) == 4);
+
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try
+    {
+      b.getElem(-2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testGetElem2(TestHarness harness) {
+    harness.checkPoint("getElem(int, int)");  
+    
+    byte[][] source = new byte[][] {{1, 2}, {3, 4}};
+    DataBufferByte b = new DataBufferByte(source, 2);
+    harness.check(b.getElem(1, 0) == 3);
+    harness.check(b.getElem(1, 1) == 4);
+    
+    // test where supplied array is bigger than 'size'
+    source = new byte[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferByte(source, 2);
+    harness.check(b.getElem(1, 2) == 6);
+      
+    // test where offsets are specified
+    source = new byte[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferByte(source, 2, new int[] {1, 2});
+    harness.check(b.getElem(1, -2) == 5);
+    harness.check(b.getElem(1, -1) == 6);
+    harness.check(b.getElem(1, 0) == 7);
+    harness.check(b.getElem(1, 1) == 8);
+       
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(source[1][2] == 99);
+    harness.check(b.getElem(1, 0) == 99);
+        
+    // test when the bank index is out of bounds
+    boolean pass = true;
+    try
+    {
+      b.getElem(-1, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(2, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test when the item index is out of bounds
+    pass = true;
+    try
+    {
+      b.getElem(0, -2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(1, 5);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // the array of arrays should reflect the single dimension array
+    DataBufferByte b2 = new DataBufferByte(new byte[] {1, 2, 3}, 3);
+    harness.check(b2.getElem(0, 1) == 2);
   }
 }
Index: constructors.java
===================================================================
RCS file: constructors.java
diff -N constructors.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ constructors.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,256 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.java.awt.image.DataBufferByte;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+
+/**
+ * Some tests for the constructors in the {@link DataBufferByte} class.
+ */
+public class constructors implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testConstructor1(harness);
+    testConstructor2(harness);
+    testConstructor3(harness);
+    testConstructor4(harness);
+    testConstructor5(harness);
+    testConstructor6(harness);
+  }
+
+  private void testConstructor1(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferByte(int)");
+    DataBufferByte b1 = new DataBufferByte(1);
+    harness.check(b1.getDataType() == DataBuffer.TYPE_BYTE);
+    harness.check(b1.getSize() == 1);
+    harness.check(b1.getNumBanks() == 1);
+    harness.check(b1.getOffset() == 0);
+  
+    DataBufferByte b2 = new DataBufferByte(0);
+    harness.check(b2.getSize() == 0);
+    harness.check(b2.getNumBanks() == 1);
+    harness.check(b2.getOffset() == 0);
+  
+    boolean pass = false;
+    try 
+    {
+      DataBufferByte b3 = new DataBufferByte(-1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testConstructor2(TestHarness harness)   
+  {
+    harness.checkPoint("DataBufferByte(byte[][], int)");
+    byte[][] source = new byte[][] {{1, 2}};
+    DataBufferByte b = new DataBufferByte(source, 1);
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+  
+    // does a change to the source array affect the buffer? yes
+    byte[][] banks = b.getBankData();
+    harness.check(banks[0][0] == 1);
+    source[0][0] = 3;
+    harness.check(banks[0][0] == 3);
+  
+    // check null source
+    boolean pass = false;
+    try 
+    {
+      DataBufferByte b1 = new DataBufferByte((byte[][]) null, 1);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // check negative size
+    DataBufferByte b1 = new DataBufferByte(source, -1);
+    harness.check(b1.getSize() == -1);
+  }
+
+  private void testConstructor3(TestHarness harness)  
+  {
+    harness.checkPoint("DataBufferByte(byte[][], int, int[])");
+    byte[][] source = new byte[][] {{1, 2}};
+    DataBufferByte b = new DataBufferByte(source, 1, new int[] {0});
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    // test where offsets are specified
+    source = new byte[][] {{1, 2, 3}, {4, 5, 6, 7}};
+    b = new DataBufferByte(source, 2, new int[] {0, 1});
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 2);
+    harness.check(b.getOffsets()[1] == 1);
+    harness.check(b.getElem(1, 0) == 5);
+
+    // check null source
+    boolean pass = false;
+    try 
+    {
+      DataBufferByte b1 = new DataBufferByte((byte[][]) null, 1, new int[] {0});
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+    // check null offsets
+    pass = false;
+    try 
+    {
+      DataBufferByte b1 = new DataBufferByte(new byte[][]{{1, 2}}, 1, (int[]) null);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+   
+    // check source doesn't match offsets array
+    pass = false;
+    try
+    {
+      DataBufferByte b2 = new DataBufferByte(new byte[][]{{1, 2}}, 1, new int[] {0, 0});
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+  }
+
+  private void testConstructor4(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferByte(byte[], int)");
+    DataBufferByte b = new DataBufferByte(new byte[] {1, 2}, 2);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+  
+    // check null source
+    boolean pass = false;
+    try 
+    {
+      // this constructor doesn't throw an exception until you
+      // try to access the (null) data bank
+      DataBufferByte b1 = new DataBufferByte((byte[]) null, 1);
+      int ignore = b1.getElem(0);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testConstructor5(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferByte(byte[], int, int)");
+    DataBufferByte b = new DataBufferByte(new byte[] {1, 2}, 2, 0);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+  
+    boolean pass = false;
+    try 
+    {
+      // this constructor doesn't throw an exception until you
+      // try to access the (null) data bank
+      DataBufferByte b1 = new DataBufferByte((byte[]) null, 1, 0);
+      int ignore = b1.getElem(0);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // does negative size fail? no
+    pass = true;
+    try 
+    {
+      DataBufferByte b2 = new DataBufferByte(new byte[] {1, 2}, -1, 0);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = false;
+    }
+    harness.check(pass);
+    
+  }
+
+  private void testConstructor6(TestHarness harness)  
+  {
+    harness.checkPoint("DataBufferByte(int, int)");
+    DataBufferByte b = new DataBufferByte(2, 3);
+    harness.check(b.getNumBanks() == 3);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getOffset() == 0);
+  
+    // does negative size fail? yes
+    boolean pass = false;
+    try 
+    {
+      DataBufferByte b1 = new DataBufferByte(-1, 1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // does negative banks fail? yes
+    pass = false;
+    try 
+    {
+      DataBufferByte b1 = new DataBufferByte(1, -1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
+
Index: getBankData.java
===================================================================
RCS file: getBankData.java
diff -N getBankData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getBankData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,78 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferByte;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferByte;
+import java.util.Arrays;
+
+/**
+ * Some tests for the getBankData() method in the {@link DataBufferByte} class.
+ */
+public class getBankData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    // check that array updates pass through
+    byte[][] data = new byte[][] {{1, 2}};
+    DataBufferByte b = new DataBufferByte(data, 2);
+    byte[][] banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+    data[0][0] = 3;
+    harness.check(banks[0][0] == 3);
+  
+    // test where supplied array is bigger than 'size'
+    data = new byte[][] {{1, 2, 3}};
+    b = new DataBufferByte(data, 2);
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+  
+    // test where offsets are specified
+    data = new byte[][] {{1, 2, 3}, {4, 5, 6, 7}};
+    b = new DataBufferByte(data, 2, new int[] {0, 1});
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+  
+    // check that a single bank buffer returns a valid array
+    DataBufferByte b2 = new DataBufferByte(new byte[] {1, 2}, 2);
+    banks = b2.getBankData();
+    harness.check(banks.length == 1);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[0][1] == 2);
+  
+    // check that a multi bank buffer returns a valid array
+    DataBufferByte b3 = new DataBufferByte(new byte[][] {{1}, {2}}, 1);
+    banks = b3.getBankData();
+    harness.check(banks.length == 2);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[1][0] == 2);
+  }
+
+}
Index: getData.java
===================================================================
RCS file: getData.java
diff -N getData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,138 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferByte;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferByte;
+
+/**
+ * Some tests for the geData() methods in the {@link DataBufferByte} class.
+ */
+public class getData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    testGetData1(harness);
+    testGetData2(harness); 
+  }
+
+  private void testGetData1(TestHarness harness) {
+    harness.checkPoint("getData()");  
+  
+    // check simple case
+    byte[] source = new byte[] {1, 2};
+    DataBufferByte b = new DataBufferByte(source, 2);
+    byte[] data = b.getData();
+    harness.check(data.length == 2);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+
+    // test where supplied array is bigger than 'size'
+    source = new byte[] {1, 2, 3};
+    b = new DataBufferByte(source, 2);
+    data = b.getData();
+    harness.check(data.length == 3);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+
+    // test where offsets are specified
+    source = new byte[] {1, 2, 3, 4};
+    b = new DataBufferByte(source, 2, 1);
+    data = b.getData();
+    harness.check(data.length == 4);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+    harness.check(data[3] == 4);
+  
+    // does a change to the source affect the DataBuffer? Yes
+    source[2] = 99;
+    harness.check(data[2] == 99); 
+  }
+
+  private void testGetData2(TestHarness harness) {
+    harness.checkPoint("getData(int)");  
+    
+    byte[][] source = new byte[][] {{1, 2}, {3, 4}};
+    DataBufferByte b = new DataBufferByte(source, 2);
+    byte[] data = b.getData(1);
+    harness.check(data.length == 2);
+    harness.check(data[0] == 3);
+    harness.check(data[1] == 4);
+  
+    // test where supplied array is bigger than 'size'
+    source = new byte[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferByte(source, 2);
+    data = b.getData(1);
+    harness.check(data.length == 3);
+    harness.check(data[0] == 4);
+    harness.check(data[1] == 5);
+    harness.check(data[2] == 6);
+  
+    // test where offsets are specified
+    source = new byte[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferByte(source, 2, new int[] {1, 2});
+    data = b.getData(1);
+    harness.check(data.length == 4);
+    harness.check(data[0] == 5);
+    harness.check(data[1] == 6);
+    harness.check(data[2] == 7);
+    harness.check(data[3] == 8);
+    
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(data[2] == 99);
+    
+    // check bounds exceptions
+    boolean pass = true;
+    try
+    {
+      b.getData(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+   
+    pass = false;
+    try 
+    {
+      b.getData(2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: setElem.java
===================================================================
RCS file: setElem.java
diff -N setElem.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ setElem.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,120 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferByte;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferByte;
+
+/**
+ * Some tests for the setElem() methods in the {@link DataBufferByte} class.
+ */
+public class setElem implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testSetElem1(harness);
+    testSetElem2(harness);  
+  }
+
+  private void testSetElem1(TestHarness harness) {
+    harness.checkPoint("setElem(int, int)");  
+
+    byte[] source = new byte[] {1, 2};
+    DataBufferByte b = new DataBufferByte(source, 2);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99);
+  
+    // does the source array get updated? Yes
+    harness.check(source[1] == 99);
+
+    // test with offsets
+    source = new byte[] {1, 2, 3, 4, 5};
+    b = new DataBufferByte(source, 4, 1);
+    harness.check(b.getElem(1) == 3);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99); 
+    harness.check(source[2] == 99);
+  
+    boolean pass = false;
+    try
+    {
+      b.setElem(-2, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+    pass = false;
+    try
+    {
+      b.setElem(4, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testSetElem2(TestHarness harness) {
+    harness.checkPoint("setElem(int, int, int)");  
+  
+    byte[][] source = new byte[][] {{1, 2}, {3, 4}};
+    DataBufferByte b = new DataBufferByte(source, 2);
+    b.setElem(1, 1, 99);
+    harness.check(b.getElem(1, 1) == 99);
+    // does the source array get updated?
+    harness.check(source[1][1] == 99);
+
+    boolean pass = false;
+    try
+    {
+      b.setElem(-1, 1, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try
+    {
+      b.setElem(2, 1, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: getDataType.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/DataBufferDouble/getDataType.java,v
retrieving revision 1.1
diff -u -r1.1 getDataType.java
--- getDataType.java	14 Apr 2004 11:33:35 -0000	1.1
+++ getDataType.java	1 Sep 2004 14:31:19 -0000
@@ -21,8 +21,8 @@
 
 package gnu.testlet.java.awt.image.DataBufferDouble;
 
-import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
 
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferDouble;
Index: getElem.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/DataBufferDouble/getElem.java,v
retrieving revision 1.1
diff -u -r1.1 getElem.java
--- getElem.java	14 Apr 2004 11:33:35 -0000	1.1
+++ getElem.java	1 Sep 2004 14:31:19 -0000
@@ -21,8 +21,8 @@
 
 package gnu.testlet.java.awt.image.DataBufferDouble;
 
-import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
 
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferDouble;
@@ -48,5 +48,151 @@
     h.check(buf.getElem(0, 1), -4); // Check #4.
     h.check(buf.getElem(1, 0), 1);  // Check #5.
     h.check(buf.getElem(1, 1), -2); // Check #6.
+    // new tests added by David Gilbert
+    testGetElem1(h);
+    testGetElem2(h);
+    
+  }
+  
+  private void testGetElem1(TestHarness harness) 
+  {
+    harness.checkPoint("getElem(int)");  
+      
+    // test where supplied array is bigger than 'size'
+    double[] source = new double[] {1, 2, 3};
+    DataBufferDouble b = new DataBufferDouble(source, 2);
+    harness.check(b.getElem(0) == 1);
+    harness.check(b.getElem(1) == 2);
+    harness.check(b.getElem(2) == 3);
+    
+    boolean pass = false;
+    try
+    {
+      b.getElem(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test where offsets are specified
+    source = new double[] {1, 2, 3, 4};
+    b = new DataBufferDouble(source, 2, 1);
+    harness.check(b.getElem(-1) == 1);
+    harness.check(b.getElem(0) == 2);
+    harness.check(b.getElem(1) == 3);
+    harness.check(b.getElem(2) == 4);
+
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try
+    {
+      b.getElem(-2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testGetElem2(TestHarness harness) {
+    harness.checkPoint("getElem(int, int)");  
+    
+    double[][] source = new double[][] {{1, 2}, {3, 4}};
+    DataBufferDouble b = new DataBufferDouble(source, 2);
+    harness.check(b.getElem(1, 0) == 3);
+    harness.check(b.getElem(1, 1) == 4);
+    
+    // test where supplied array is bigger than 'size'
+    source = new double[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferDouble(source, 2);
+    harness.check(b.getElem(1, 2) == 6);
+      
+    // test where offsets are specified
+    source = new double[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferDouble(source, 2, new int[] {1, 2});
+    harness.check(b.getElem(1, -2) == 5);
+    harness.check(b.getElem(1, -1) == 6);
+    harness.check(b.getElem(1, 0) == 7);
+    harness.check(b.getElem(1, 1) == 8);
+       
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(source[1][2] == 99);
+    harness.check(b.getElem(1, 0) == 99);
+        
+    // test when the bank index is out of bounds
+    boolean pass = true;
+    try
+    {
+      b.getElem(-1, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(2, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test when the item index is out of bounds
+    pass = true;
+    try
+    {
+      b.getElem(0, -2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(1, 5);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // the array of arrays should reflect the single dimension array
+    DataBufferDouble b2 = new DataBufferDouble(new double[] {1, 2, 3}, 3);
+    harness.check(b2.getElem(0, 1) == 2);
   }
+  
 }
Index: constructors.java
===================================================================
RCS file: constructors.java
diff -N constructors.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ constructors.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,255 @@
+//Tags: JDK1.4
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.java.awt.image.DataBufferDouble;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferDouble;
+
+/**
+ * Some tests for the constructors in the {@link DataBufferDouble} class.
+ */
+public class constructors implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testConstructor1(harness);
+    testConstructor2(harness);
+    testConstructor3(harness);
+    testConstructor4(harness);
+    testConstructor5(harness);
+    testConstructor6(harness);  
+  }
+
+  private void testConstructor1(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferDouble(int)");
+    DataBufferDouble b1 = new DataBufferDouble(1);
+    harness.check(b1.getDataType() == DataBuffer.TYPE_DOUBLE);
+    harness.check(b1.getSize() == 1);
+    harness.check(b1.getNumBanks() == 1);
+    harness.check(b1.getOffset() == 0);
+
+    DataBufferDouble b2 = new DataBufferDouble(0);
+    harness.check(b2.getSize() == 0);
+    harness.check(b2.getNumBanks() == 1);
+    harness.check(b2.getOffset() == 0);
+
+    boolean pass = false;
+    try 
+    {
+        DataBufferDouble b3 = new DataBufferDouble(-1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testConstructor2(TestHarness harness)   
+  {
+    harness.checkPoint("DataBufferDouble(double[][], int)");
+    double[][] source = new double[][] {{1.0, 2.0}};
+    DataBufferDouble b = new DataBufferDouble(source, 1);
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    // does a change to the source array affect the buffer? yes
+    double[][] banks = b.getBankData();
+    harness.check(banks[0][0] == 1.0);
+    source[0][0] = 3.0;
+    harness.check(banks[0][0] == 3.0);
+
+    // check null source
+    boolean pass = false;
+    try 
+    {
+      DataBufferDouble b1 = new DataBufferDouble((double[][]) null, 1);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+    // check negative size
+    DataBufferDouble b1 = new DataBufferDouble(source, -1);
+    harness.check(b1.getSize() == -1);
+  }
+
+  private void testConstructor3(TestHarness harness)  
+  {
+    harness.checkPoint("DataBufferDouble(double[][], int, int[])");
+    double[][] source = new double[][] {{1, 2}};
+    DataBufferDouble b = new DataBufferDouble(source, 1, new int[] {0});
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    // test where offsets are specified
+    source = new double[][] {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0, 7.0}};
+    b = new DataBufferDouble(source, 2, new int[] {0, 1});
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 2);
+    harness.check(b.getOffsets()[1] == 1);
+    harness.check(b.getElem(1, 0) == 5);
+
+    // check null source
+    boolean pass = false;
+    try 
+    {
+      DataBufferDouble b1 = new DataBufferDouble((double[][]) null, 1, new int[] {0});
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // check null offsets
+    pass = false;
+    try 
+    {
+      DataBufferDouble b1 = new DataBufferDouble(new double[][]{{1.0, 2.0}}, 1, (int[]) null);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass); 
+ 
+    // check source doesn't match offsets array
+    pass = false;
+    try
+    {
+      DataBufferDouble b2 = new DataBufferDouble(new double[][]{{1.0, 2.0}}, 1, new int[] {0, 0});
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+  }
+
+  private void testConstructor4(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferDouble(double[], int)");
+    DataBufferDouble b = new DataBufferDouble(new double[] {1, 2}, 2);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+ 
+    boolean pass = false;
+    try 
+    {
+      // this constructor doesn't throw an exception until you
+      // try to access the (null) data bank
+      DataBufferDouble b1 = new DataBufferDouble((double[]) null, 1);
+      int ignore = b1.getElem(0);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testConstructor5(TestHarness harness)  
+  {
+    harness.checkPoint("DataBufferDouble(double[], int, int)");
+    DataBufferDouble b = new DataBufferDouble(new double[] {1, 2}, 2, 0);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    boolean pass = false;
+    try 
+    {
+      // this constructor doesn't throw an exception until you
+      // try to access the (null) data bank
+      DataBufferDouble b1 = new DataBufferDouble((double[]) null, 1, 0);
+      int ignore = b1.getElem(0);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // does negative size fail? no
+    pass = true;
+    try 
+    {
+      DataBufferDouble b1 = new DataBufferDouble(new double[] {1, 2}, -1, 0);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = false;
+    }
+    harness.check(pass);
+  
+  }
+
+  private void testConstructor6(TestHarness harness)  
+  {
+    harness.checkPoint("DataBufferDouble(int, int)");
+    DataBufferDouble b = new DataBufferDouble(2, 3);
+    harness.check(b.getNumBanks() == 3);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getOffset() == 0) ;
+ 
+    // does negative size fail? yes
+    boolean pass = false;
+    try 
+    {
+      DataBufferDouble b1 = new DataBufferDouble(-1, 1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // does negative banks fail? yes
+    pass = false;
+    try 
+    {
+      DataBufferDouble b1 = new DataBufferDouble(1, -1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass); 
+  }
+
+}
+
Index: getBankData.java
===================================================================
RCS file: getBankData.java
diff -N getBankData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getBankData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,78 @@
+//Tags: JDK1.4
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferDouble;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferDouble;
+import java.util.Arrays;
+
+/**
+ * Some tests for the getBankData() method in the {@link DataBufferDouble} class.
+ */
+public class getBankData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    // check that array updates pass through
+    double[][] data = new double[][] {{1, 2}};
+    DataBufferDouble b = new DataBufferDouble(data, 2);
+    double[][] banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+    data[0][0] = 3;
+    harness.check(banks[0][0] == 3);
+ 
+    // test where supplied array is bigger than 'size'
+    data = new double[][] {{1, 2, 3}};
+    b = new DataBufferDouble(data, 2);
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data)); 
+ 
+    // test where offsets are specified
+    data = new double[][] {{1, 2, 3}, {4, 5, 6, 7}};
+    b = new DataBufferDouble(data, 2, new int[] {0, 1});
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+
+    // check that a single bank buffer returns a valid array
+    DataBufferDouble b2 = new DataBufferDouble(new double[] {1, 2}, 2);
+    banks = b2.getBankData();
+    harness.check(banks.length == 1);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[0][1] == 2);
+
+    // check that a multi bank buffer returns a valid array
+    DataBufferDouble b3 = new DataBufferDouble(new double[][] {{1}, {2}}, 1);
+    banks = b3.getBankData();
+    harness.check(banks.length == 2);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[1][0] == 2);
+  }
+
+}
Index: getData.java
===================================================================
RCS file: getData.java
diff -N getData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,138 @@
+//Tags: JDK1.4
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferDouble;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferDouble;
+
+/**
+ * Some tests for the geData() methods in the {@link DataBufferDouble} class.
+ */
+public class getData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testGetData1(harness);
+    testGetData2(harness);
+  }
+
+  private void testGetData1(TestHarness harness) {
+    harness.checkPoint("getData()");  
+
+    // check simple case
+    double[] source = new double[] {1, 2};
+    DataBufferDouble b = new DataBufferDouble(source, 2);
+    double[] data = b.getData();
+    harness.check(data.length == 2);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+
+    // test where supplied array is bigger than 'size'
+    source = new double[] {1, 2, 3};
+    b = new DataBufferDouble(source, 2);
+    data = b.getData();
+    harness.check(data.length == 3);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+
+    // test where offsets are specified
+    source = new double[] {1, 2, 3, 4};
+    b = new DataBufferDouble(source, 2, 1);
+    data = b.getData();
+    harness.check(data.length == 4);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+    harness.check(data[3] == 4);
+
+    // does a change to the source affect the DataBuffer? Yes
+    source[2] = 99;
+    harness.check(data[2] == 99);
+  }
+
+  private void testGetData2(TestHarness harness) {
+    harness.checkPoint("getData(int)");  
+
+    double[][] source = new double[][] {{1, 2}, {3, 4}};
+    DataBufferDouble b = new DataBufferDouble(source, 2);
+    double[] data = b.getData(1);
+    harness.check(data.length == 2);
+    harness.check(data[0] == 3);
+    harness.check(data[1] == 4);
+
+    // test where supplied array is bigger than 'size'
+    source = new double[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferDouble(source, 2);
+    data = b.getData(1);
+    harness.check(data.length == 3);
+    harness.check(data[0] == 4);
+    harness.check(data[1] == 5);
+    harness.check(data[2] == 6);
+
+    // test where offsets are specified
+    source = new double[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferDouble(source, 2, new int[] {1, 2});
+    data = b.getData(1);
+    harness.check(data.length == 4);
+    harness.check(data[0] == 5);
+    harness.check(data[1] == 6);
+    harness.check(data[2] == 7);
+    harness.check(data[3] == 8);
+
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(data[2] == 99);
+
+    // check bounds exceptions
+    boolean pass = true;
+    try
+    {
+      b.getData(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try 
+    {
+      b.getData(2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: setElem.java
===================================================================
RCS file: setElem.java
diff -N setElem.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ setElem.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,120 @@
+//Tags: JDK1.4
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferDouble;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferDouble;
+
+/**
+ * Some tests for the setElem() methods in the {@link DataBufferDouble} class.
+ */
+public class setElem implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testSetElem1(harness);
+    testSetElem2(harness);  
+  }
+
+  private void testSetElem1(TestHarness harness) {
+    harness.checkPoint("setElem(int, int)");  
+
+    double[] source = new double[] {1, 2};
+    DataBufferDouble b = new DataBufferDouble(source, 2);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99);
+
+    // does the source array get updated? Yes
+    harness.check(source[1] == 99);
+
+    // test with offsets
+    source = new double[] {1, 2, 3, 4, 5};
+    b = new DataBufferDouble(source, 4, 1);
+    harness.check(b.getElem(1) == 3);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99); 
+    harness.check(source[2] == 99);
+
+    boolean pass = false;
+    try
+    {
+      b.setElem(-2, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try
+    {
+      b.setElem(4, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testSetElem2(TestHarness harness) {
+    harness.checkPoint("setElem(int, int, int)");   
+
+    double[][] source = new double[][] {{1, 2}, {3, 4}};
+    DataBufferDouble b = new DataBufferDouble(source, 2);
+    b.setElem(1, 1, 99);
+    harness.check(b.getElem(1, 1) == 99);
+    // does the source array get updated?
+    harness.check(source[1][1] == 99);
+
+    boolean pass = false;
+    try
+    {
+      b.setElem(-1, 1, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+    pass = false;
+    try
+    {
+      b.setElem(2, 1, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: getElem.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/DataBufferFloat/getElem.java,v
retrieving revision 1.2
diff -u -r1.2 getElem.java
--- getElem.java	27 Aug 2004 11:05:07 -0000	1.2
+++ getElem.java	1 Sep 2004 14:31:53 -0000
@@ -48,5 +48,150 @@
     h.check(buf.getElem(0, 1), -4); // Check #4.
     h.check(buf.getElem(1, 0), 1);  // Check #5.
     h.check(buf.getElem(1, 1), -2); // Check #6.
+    // new tests added by David Gilbert
+    testGetElem1(h);
+    testGetElem2(h);
+    
+  }
+  
+  private void testGetElem1(TestHarness harness) 
+  {
+    harness.checkPoint("getElem(int)");  
+      
+    // test where supplied array is bigger than 'size'
+    float[] source = new float[] {1, 2, 3};
+    DataBufferFloat b = new DataBufferFloat(source, 2);
+    harness.check(b.getElem(0) == 1);
+    harness.check(b.getElem(1) == 2);
+    harness.check(b.getElem(2) == 3);
+    
+    boolean pass = false;
+    try
+    {
+      b.getElem(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test where offsets are specified
+    source = new float[] {1, 2, 3, 4};
+    b = new DataBufferFloat(source, 2, 1);
+    harness.check(b.getElem(-1) == 1);
+    harness.check(b.getElem(0) == 2);
+    harness.check(b.getElem(1) == 3);
+    harness.check(b.getElem(2) == 4);
+
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try
+    {
+      b.getElem(-2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testGetElem2(TestHarness harness) {
+    harness.checkPoint("getElem(int, int)");  
+    
+    float[][] source = new float[][] {{1, 2}, {3, 4}};
+    DataBufferFloat b = new DataBufferFloat(source, 2);
+    harness.check(b.getElem(1, 0) == 3);
+    harness.check(b.getElem(1, 1) == 4);
+    
+    // test where supplied array is bigger than 'size'
+    source = new float[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferFloat(source, 2);
+    harness.check(b.getElem(1, 2) == 6);
+      
+    // test where offsets are specified
+    source = new float[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferFloat(source, 2, new int[] {1, 2});
+    harness.check(b.getElem(1, -2) == 5);
+    harness.check(b.getElem(1, -1) == 6);
+    harness.check(b.getElem(1, 0) == 7);
+    harness.check(b.getElem(1, 1) == 8);
+       
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(source[1][2] == 99);
+    harness.check(b.getElem(1, 0) == 99);
+        
+    // test when the bank index is out of bounds
+    boolean pass = true;
+    try
+    {
+      b.getElem(-1, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(2, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test when the item index is out of bounds
+    pass = true;
+    try
+    {
+      b.getElem(0, -2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(1, 5);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // the array of arrays should reflect the single dimension array
+    DataBufferFloat b2 = new DataBufferFloat(new float[] {1, 2, 3}, 3);
+    harness.check(b2.getElem(0, 1) == 2);
   }
 }
Index: constructors.java
===================================================================
RCS file: constructors.java
diff -N constructors.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ constructors.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,255 @@
+//Tags: JDK1.4
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.java.awt.image.DataBufferFloat;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferFloat;
+
+/**
+ * Some tests for the constructors in the {@link DataBufferFloat} class.
+ */
+public class constructors implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testConstructor1(harness);
+    testConstructor2(harness);
+    testConstructor3(harness);
+    testConstructor4(harness);
+    testConstructor5(harness);
+    testConstructor6(harness);   
+  }
+
+  private void testConstructor1(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferFloat(int)");
+    DataBufferFloat b1 = new DataBufferFloat(1);
+    harness.check(b1.getDataType() == DataBuffer.TYPE_FLOAT);
+    harness.check(b1.getSize() == 1);
+    harness.check(b1.getNumBanks() == 1);
+    harness.check(b1.getOffset() == 0);
+
+    DataBufferFloat b2 = new DataBufferFloat(0);
+    harness.check(b2.getSize() == 0);
+    harness.check(b2.getNumBanks() == 1);
+    harness.check(b2.getOffset() == 0);
+
+    boolean pass = false;
+    try 
+    {
+      DataBufferFloat b3 = new DataBufferFloat(-1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testConstructor2(TestHarness harness)   
+  {
+    harness.checkPoint("DataBufferFloat(float[][], int)");
+    float[][] source = new float[][] {{1.0f, 2.0f}};
+    DataBufferFloat b = new DataBufferFloat(source, 1);
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    // does a change to the source array affect the buffer? yes
+    float[][] banks = b.getBankData();
+    harness.check(banks[0][0] == 1.0f);
+    source[0][0] = 3.0f;
+    harness.check(banks[0][0] == 3.0f);
+
+    // check null source
+    boolean pass = false;
+    try 
+    {
+      DataBufferFloat b1 = new DataBufferFloat((float[][]) null, 1);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // check negative size
+    DataBufferFloat b1 = new DataBufferFloat(source, -1);
+    harness.check(b1.getSize() == -1);
+  }
+
+  private void testConstructor3(TestHarness harness)  
+  {
+    harness.checkPoint("DataBufferFloat(float[][], int, int[])");
+    float[][] source = new float[][] {{1, 2}};
+    DataBufferFloat b = new DataBufferFloat(source, 1, new int[] {0});
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    // test where offsets are specified
+    source = new float[][] {{1.0f, 2.0f, 3.0f}, {4.0f, 5.0f, 6.0f, 7.0f}};
+    b = new DataBufferFloat(source, 2, new int[] {0, 1});
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 2);
+    harness.check(b.getOffsets()[1] == 1);
+    harness.check(b.getElem(1, 0) == 5);
+
+    // check null source
+    boolean pass = false;
+    try 
+    {
+      DataBufferFloat b1 = new DataBufferFloat((float[][]) null, 1, new int[] {0});
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // check null offsets
+    pass = false;
+    try 
+    {
+      DataBufferFloat b1 = new DataBufferFloat(new float[][]{{1.0f, 2.0f}}, 1, (int[]) null);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass); 
+
+    // check source doesn't match offsets array
+    pass = false;
+    try
+    {
+      DataBufferFloat b2 = new DataBufferFloat(new float[][]{{1.0f, 2.0f}}, 1, new int[] {0, 0});
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+  }
+
+  private void testConstructor4(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferFloat(float[], int)");
+    DataBufferFloat b = new DataBufferFloat(new float[] {1, 2}, 2);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    boolean pass = false;
+    try 
+    {
+      // this constructor doesn't throw an exception until you
+      // try to access the (null) data bank
+      DataBufferFloat b1 = new DataBufferFloat((float[]) null, 1);
+      int ignore = b1.getElem(0);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testConstructor5(TestHarness harness)  
+  {
+    harness.checkPoint("DataBufferFloat(float[], int, int)");
+    DataBufferFloat b = new DataBufferFloat(new float[] {1, 2}, 2, 0);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    boolean pass = false;
+    try 
+    {
+      // this constructor doesn't throw an exception until you
+      // try to access the (null) data bank
+      DataBufferFloat b1 = new DataBufferFloat((float[]) null, 1, 0);
+      int ignore = b1.getElem(0);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+    // does negative size fail? no
+    pass = true;
+    try 
+    {
+      DataBufferFloat b2 = new DataBufferFloat(new float[] {1, 2}, -1, 0);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = false;
+    }
+    harness.check(pass);
+
+  }
+
+  private void testConstructor6(TestHarness harness)    
+  {
+    harness.checkPoint("DataBufferFloat(int, int)");
+    DataBufferFloat b = new DataBufferFloat(2, 3);
+    harness.check(b.getNumBanks() == 3);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getOffset() == 0);
+ 
+    // does negative size fail? yes
+    boolean pass = false;
+    try 
+    {
+      DataBufferFloat b1 = new DataBufferFloat(-1, 1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // does negative banks fail? yes
+    pass = false;
+    try 
+    {
+      DataBufferFloat b1 = new DataBufferFloat(1, -1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass); 
+  }
+
+}
+
Index: getBankData.java
===================================================================
RCS file: getBankData.java
diff -N getBankData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getBankData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,78 @@
+//Tags: JDK1.4
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferFloat;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferFloat;
+import java.util.Arrays;
+
+/**
+ * Some tests for the getBankData() method in the {@link DataBufferFloat} class.
+ */
+public class getBankData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    // check that array updates pass through
+    float[][] data = new float[][] {{1, 2}};
+    DataBufferFloat b = new DataBufferFloat(data, 2);
+    float[][] banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+    data[0][0] = 3;
+    harness.check(banks[0][0] == 3);
+   
+    // test where supplied array is bigger than 'size'
+    data = new float[][] {{1, 2, 3}};
+    b = new DataBufferFloat(data, 2);
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+   
+    // test where offsets are specified
+    data = new float[][] {{1, 2, 3}, {4, 5, 6, 7}};
+    b = new DataBufferFloat(data, 2, new int[] {0, 1});
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+  
+    // check that a single bank buffer returns a valid array
+    DataBufferFloat b2 = new DataBufferFloat(new float[] {1, 2}, 2);
+    banks = b2.getBankData();
+    harness.check(banks.length == 1);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[0][1] == 2);
+  
+    // check that a multi bank buffer returns a valid array
+    DataBufferFloat b3 = new DataBufferFloat(new float[][] {{1}, {2}}, 1);
+    banks = b3.getBankData();
+    harness.check(banks.length == 2);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[1][0] == 2);
+  }
+
+}
Index: getData.java
===================================================================
RCS file: getData.java
diff -N getData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,138 @@
+//Tags: JDK1.4
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferFloat;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferFloat;
+
+/**
+ * Some tests for the geData() methods in the {@link DataBufferFloat} class.
+ */
+public class getData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testGetData1(harness);
+    testGetData2(harness);
+  }
+
+  private void testGetData1(TestHarness harness) {
+    harness.checkPoint("getData()");  
+
+    // check simple case
+    float[] source = new float[] {1, 2};
+    DataBufferFloat b = new DataBufferFloat(source, 2);
+    float[] data = b.getData();
+    harness.check(data.length == 2);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+
+    // test where supplied array is bigger than 'size'
+    source = new float[] {1, 2, 3};
+    b = new DataBufferFloat(source, 2);
+    data = b.getData();
+    harness.check(data.length == 3);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+
+    // test where offsets are specified
+    source = new float[] {1, 2, 3, 4};
+    b = new DataBufferFloat(source, 2, 1);
+    data = b.getData();
+    harness.check(data.length == 4);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+    harness.check(data[3] == 4);
+
+    // does a change to the source affect the DataBuffer? Yes
+    source[2] = 99;
+    harness.check(data[2] == 99);
+  }
+
+  private void testGetData2(TestHarness harness) {
+    harness.checkPoint("getData(int)");  
+
+    float[][] source = new float[][] {{1, 2}, {3, 4}};
+    DataBufferFloat b = new DataBufferFloat(source, 2);
+    float[] data = b.getData(1);
+    harness.check(data.length == 2);
+    harness.check(data[0] == 3);
+    harness.check(data[1] == 4);
+
+    // test where supplied array is bigger than 'size'
+    source = new float[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferFloat(source, 2);
+    data = b.getData(1);
+    harness.check(data.length == 3);
+    harness.check(data[0] == 4);
+    harness.check(data[1] == 5);
+    harness.check(data[2] == 6);
+
+    // test where offsets are specified
+    source = new float[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferFloat(source, 2, new int[] {1, 2});
+    data = b.getData(1);
+    harness.check(data.length == 4);
+    harness.check(data[0] == 5);
+    harness.check(data[1] == 6);
+    harness.check(data[2] == 7);
+    harness.check(data[3] == 8);
+
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(data[2] == 99);
+
+    // check bounds exceptions
+    boolean pass = true;
+    try
+    {
+      b.getData(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try 
+    {
+      b.getData(2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: setElem.java
===================================================================
RCS file: setElem.java
diff -N setElem.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ setElem.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,120 @@
+//Tags: JDK1.4
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferFloat;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferFloat;
+
+/**
+ * Some tests for the setElem() methods in the {@link DataBufferFloat} class.
+ */
+public class setElem implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testSetElem1(harness);
+    testSetElem2(harness);  
+  }
+
+  private void testSetElem1(TestHarness harness) {
+    harness.checkPoint("setElem(int, int)");  
+
+    float[] source = new float[] {1, 2};
+    DataBufferFloat b = new DataBufferFloat(source, 2);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99);
+
+    // does the source array get updated? Yes
+    harness.check(source[1] == 99);
+
+    // test with offsets
+    source = new float[] {1, 2, 3, 4, 5};
+    b = new DataBufferFloat(source, 4, 1);
+    harness.check(b.getElem(1) == 3);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99); 
+    harness.check(source[2] == 99);
+
+    boolean pass = false;
+    try
+    {
+      b.setElem(-2, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try
+    {
+      b.setElem(4, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testSetElem2(TestHarness harness) {
+    harness.checkPoint("setElem(int, int, int)");   
+
+    float[][] source = new float[][] {{1, 2}, {3, 4}};
+    DataBufferFloat b = new DataBufferFloat(source, 2);
+    b.setElem(1, 1, 99);
+    harness.check(b.getElem(1, 1) == 99);
+    // does the source array get updated?
+    harness.check(source[1][1] == 99);
+
+    boolean pass = false;
+    try
+    {
+      b.setElem(-1, 1, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass); 
+
+    pass = false;
+    try
+    {
+      b.setElem(2, 1, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: getDataType.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/DataBufferInt/getDataType.java,v
retrieving revision 1.1
diff -u -r1.1 getDataType.java
--- getDataType.java	14 Apr 2004 11:33:35 -0000	1.1
+++ getDataType.java	1 Sep 2004 21:26:31 -0000
@@ -21,8 +21,8 @@
 
 package gnu.testlet.java.awt.image.DataBufferInt;
 
-import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
 
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferInt;
Index: getElem.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/DataBufferInt/getElem.java,v
retrieving revision 1.1
diff -u -r1.1 getElem.java
--- getElem.java	14 Apr 2004 11:33:35 -0000	1.1
+++ getElem.java	1 Sep 2004 21:26:31 -0000
@@ -21,13 +21,12 @@
 
 package gnu.testlet.java.awt.image.DataBufferInt;
 
-import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
 
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferInt;
 
-
 /**
  * @author <a href="mailto:brawer@dandelis.ch";>Sascha Brawer</a>
  */
@@ -48,5 +47,151 @@
     h.check(buf.getElem(0, 1), -44); // Check #4.
     h.check(buf.getElem(1, 0), -11); // Check #5.
     h.check(buf.getElem(1, 1), -22); // Check #6.
+    
+    // new tests added by David Gilbert
+    testGetElem1(h);
+    testGetElem2(h);
+    
+  }
+  
+  private void testGetElem1(TestHarness harness) 
+  {
+    harness.checkPoint("getElem(int)");  
+      
+    // test where supplied array is bigger than 'size'
+    int[] source = new int[] {1, 2, 3};
+    DataBufferInt b = new DataBufferInt(source, 2);
+    harness.check(b.getElem(0) == 1);
+    harness.check(b.getElem(1) == 2);
+    harness.check(b.getElem(2) == 3);
+    
+    boolean pass = false;
+    try
+    {
+      b.getElem(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test where offsets are specified
+    source = new int[] {1, 2, 3, 4};
+    b = new DataBufferInt(source, 2, 1);
+    harness.check(b.getElem(-1) == 1);
+    harness.check(b.getElem(0) == 2);
+    harness.check(b.getElem(1) == 3);
+    harness.check(b.getElem(2) == 4);
+
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try
+    {
+      b.getElem(-2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testGetElem2(TestHarness harness) {
+    harness.checkPoint("getElem(int, int)");  
+    
+    int[][] source = new int[][] {{1, 2}, {3, 4}};
+    DataBufferInt b = new DataBufferInt(source, 2);
+    harness.check(b.getElem(1, 0) == 3);
+    harness.check(b.getElem(1, 1) == 4);
+    
+    // test where supplied array is bigger than 'size'
+    source = new int[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferInt(source, 2);
+    harness.check(b.getElem(1, 2) == 6);
+      
+    // test where offsets are specified
+    source = new int[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferInt(source, 2, new int[] {1, 2});
+    harness.check(b.getElem(1, -2) == 5);
+    harness.check(b.getElem(1, -1) == 6);
+    harness.check(b.getElem(1, 0) == 7);
+    harness.check(b.getElem(1, 1) == 8);
+       
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(source[1][2] == 99);
+    harness.check(b.getElem(1, 0) == 99);
+        
+    // test when the bank index is out of bounds
+    boolean pass = true;
+    try
+    {
+      b.getElem(-1, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(2, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test when the item index is out of bounds
+    pass = true;
+    try
+    {
+      b.getElem(0, -2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(1, 5);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // the array of arrays should reflect the single dimension array
+    DataBufferInt b2 = new DataBufferInt(new int[] {1, 2, 3}, 3);
+    harness.check(b2.getElem(0, 1) == 2);
   }
 }
Index: constructors.java
===================================================================
RCS file: constructors.java
diff -N constructors.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ constructors.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,250 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.java.awt.image.DataBufferInt;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferInt;
+
+/**
+ * Some tests for the constructors in the {@link DataBufferInt} class.
+ */
+public class constructors implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testConstructor1(harness);
+    testConstructor2(harness);
+    testConstructor3(harness);
+    testConstructor4(harness);
+    testConstructor5(harness);
+    testConstructor6(harness);
+  }
+  
+  private void testConstructor1(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferInt(int)");
+    DataBufferInt b1 = new DataBufferInt(1);
+    harness.check(b1.getDataType() == DataBuffer.TYPE_INT);
+    harness.check(b1.getSize() == 1);
+    harness.check(b1.getNumBanks() == 1);
+    harness.check(b1.getOffset() == 0);
+    
+    DataBufferInt b2 = new DataBufferInt(0);
+    harness.check(b2.getSize() == 0);
+    harness.check(b2.getNumBanks() == 1);
+    harness.check(b2.getOffset() == 0);
+    
+    boolean pass = false;
+    try 
+    {
+      DataBufferInt b3 = new DataBufferInt(-1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testConstructor2(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferInt(int[][], int)");
+    int[][] source = new int[][] {{1, 2}};
+    DataBufferInt b = new DataBufferInt(source, 1);
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+    
+    // does a change to the source array affect the buffer? yes
+    int[][] banks = b.getBankData();
+    harness.check(banks[0][0] == 1);
+    source[0][0] = 3;
+    harness.check(banks[0][0] == 3);
+    
+    // check null source
+    boolean pass = false;
+    try 
+    {
+      DataBufferInt b1 = new DataBufferInt((int[][]) null, 1);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // check negative size
+    DataBufferInt b1 = new DataBufferInt(source, -1);
+    harness.check(b1.getSize() == -1);
+  }
+
+  private void testConstructor3(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferInt(int[][], int, int[])");
+    int[][] source = new int[][] {{1, 2}};
+    DataBufferInt b = new DataBufferInt(source, 1, new int[] {0});
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    // test where offsets are specified
+    source = new int[][] {{1, 2, 3}, {4, 5, 6, 7}};
+    b = new DataBufferInt(source, 2, new int[] {0, 1});
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 2);
+    harness.check(b.getOffsets()[1] == 1);
+    harness.check(b.getElem(1, 0) == 5);
+
+    boolean pass = false;
+    try 
+    {
+      DataBufferInt b1 = new DataBufferInt((int[][]) null, 1, new int[] {0});
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try 
+    {
+      DataBufferInt b1 = new DataBufferInt(new int[][]{{1, 2}}, 1, (int[]) null);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try
+    {
+      DataBufferInt b2 = new DataBufferInt(new int[][]{{1, 2}}, 1, new int[] {0, 0});
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+  }
+
+  private void testConstructor4(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferInt(int[], int)");
+    DataBufferInt b = new DataBufferInt(new int[] {1, 2}, 2);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+    
+    boolean pass = false;
+    try 
+    {
+      // this constructor doesn't throw an exception until you
+      // try to access the (null) data bank
+      DataBufferInt b1 = new DataBufferInt((int[]) null, 1);
+      int ignore = b1.getElem(0);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testConstructor5(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferInt(int[], int, int)");
+    DataBufferInt b = new DataBufferInt(new int[] {1, 2}, 2, 0);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+    
+    boolean pass = false;
+    try 
+    {
+      // this constructor doesn't throw an exception until you
+      // try to access the (null) data bank
+      DataBufferInt b1 = new DataBufferInt((int[]) null, 1, 0);
+      int ignore = b1.getElem(0);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // does negative size fail? no
+    pass = true;
+    try 
+    {
+      DataBufferInt b2 = new DataBufferInt(new int[] {1, 2}, -1, 0);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = false;
+    }
+    harness.check(pass);
+  }
+
+  private void testConstructor6(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferInt(int, int)");
+    DataBufferInt b = new DataBufferInt(2, 3);
+    harness.check(b.getNumBanks() == 3);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getOffset() == 0);
+    
+    // does negative size fail? yes
+    boolean pass = false;
+    try 
+    {
+      DataBufferInt b1 = new DataBufferInt(-1, 1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // does negative banks fail? yes
+    pass = false;
+    try 
+    {
+      DataBufferInt b1 = new DataBufferInt(1, -1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: getBankData.java
===================================================================
RCS file: getBankData.java
diff -N getBankData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getBankData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,78 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferInt;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferInt;
+import java.util.Arrays;
+
+/**
+ * Some tests for the getBankData() method in the {@link DataBufferInt} class.
+ */
+public class getBankData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    // check that array updates pass through
+    int[][] data = new int[][] {{1, 2}};
+    DataBufferInt b = new DataBufferInt(data, 2);
+    int[][] banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+    data[0][0] = 3;
+    harness.check(banks[0][0] == 3);
+    
+    // test where supplied array is bigger than 'size'
+    data = new int[][] {{1, 2, 3}};
+    b = new DataBufferInt(data, 2);
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+    
+    // test where offsets are specified
+    data = new int[][] {{1, 2, 3}, {4, 5, 6, 7}};
+    b = new DataBufferInt(data, 2, new int[] {0, 1});
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+    
+    // check that a single bank buffer returns a valid array
+    DataBufferInt b2 = new DataBufferInt(new int[] {1, 2}, 2);
+    banks = b2.getBankData();
+    harness.check(banks.length == 1);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[0][1] == 2);
+    
+    // check that a multi bank buffer returns a valid array
+    DataBufferInt b3 = new DataBufferInt(new int[][] {{1}, {2}}, 1);
+    banks = b3.getBankData();
+    harness.check(banks.length == 2);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[1][0] == 2);
+  }
+  
+}
Index: getData.java
===================================================================
RCS file: getData.java
diff -N getData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,138 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferInt;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferInt;
+
+/**
+ * Some tests for the geData() methods in the {@link DataBufferInt} class.
+ */
+public class getData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testGetData1(harness);
+    testGetData2(harness);
+  }
+  
+  private void testGetData1(TestHarness harness) {
+    harness.checkPoint("getData()");  
+    
+    // check simple case
+    int[] source = new int[] {1, 2};
+    DataBufferInt b = new DataBufferInt(source, 2);
+    int[] data = b.getData();
+    harness.check(data.length == 2);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+  
+    // test where supplied array is bigger than 'size'
+    source = new int[] {1, 2, 3};
+    b = new DataBufferInt(source, 2);
+    data = b.getData();
+    harness.check(data.length == 3);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+  
+    // test where offsets are specified
+    source = new int[] {1, 2, 3, 4};
+    b = new DataBufferInt(source, 2, 1);
+    data = b.getData();
+    harness.check(data.length == 4);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+    harness.check(data[3] == 4);
+    
+    // does a change to the source affect the DataBuffer? Yes
+    source[2] = 99;
+    harness.check(data[2] == 99);
+  }
+
+  private void testGetData2(TestHarness harness) {
+    harness.checkPoint("getData(int)");  
+      
+    int[][] source = new int[][] {{1, 2}, {3, 4}};
+    DataBufferInt b = new DataBufferInt(source, 2);
+    int[] data = b.getData(1);
+    harness.check(data.length == 2);
+    harness.check(data[0] == 3);
+    harness.check(data[1] == 4);
+    
+    // test where supplied array is bigger than 'size'
+    source = new int[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferInt(source, 2);
+    data = b.getData(1);
+    harness.check(data.length == 3);
+    harness.check(data[0] == 4);
+    harness.check(data[1] == 5);
+    harness.check(data[2] == 6);
+    
+    // test where offsets are specified
+    source = new int[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferInt(source, 2, new int[] {1, 2});
+    data = b.getData(1);
+    harness.check(data.length == 4);
+    harness.check(data[0] == 5);
+    harness.check(data[1] == 6);
+    harness.check(data[2] == 7);
+    harness.check(data[3] == 8);
+      
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(data[2] == 99);
+      
+    // check bounds exceptions
+    boolean pass = true;
+    try
+    {
+      b.getData(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+     
+    pass = false;
+    try 
+    {
+      b.getData(2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: setElem.java
===================================================================
RCS file: setElem.java
diff -N setElem.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ setElem.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,120 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferInt;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferInt;
+
+/**
+ * Some tests for the setElem() methods in the {@link DataBufferInt} class.
+ */
+public class setElem implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testSetElem1(harness);
+    testSetElem2(harness);
+  }
+
+  private void testSetElem1(TestHarness harness) {
+    harness.checkPoint("setElem(int, int)");  
+  
+    int[] source = new int[] {1, 2};
+    DataBufferInt b = new DataBufferInt(source, 2);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99);
+    
+    // does the source array get updated? Yes
+    harness.check(source[1] == 99);
+
+    // test with offsets
+    source = new int[] {1, 2, 3, 4, 5};
+    b = new DataBufferInt(source, 4, 1);
+    harness.check(b.getElem(1) == 3);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99); 
+    harness.check(source[2] == 99);
+    
+    boolean pass = false;
+    try
+    {
+      b.setElem(-2, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try
+    {
+      b.setElem(4, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testSetElem2(TestHarness harness) {
+      harness.checkPoint("setElem(int, int, int)");  
+    
+      int[][] source = new int[][] {{1, 2}, {3, 4}};
+      DataBufferInt b = new DataBufferInt(source, 2);
+      b.setElem(1, 1, 99);
+      harness.check(b.getElem(1, 1) == 99);
+      // does the source array get updated?
+      harness.check(source[1][1] == 99);
+
+      boolean pass = false;
+      try
+      {
+        b.setElem(-1, 1, 99);
+      }
+      catch (ArrayIndexOutOfBoundsException e) 
+      {
+        pass = true;
+      }
+      harness.check(pass);
+      
+      pass = false;
+      try
+      {
+        b.setElem(2, 1, 99);
+      }
+      catch (ArrayIndexOutOfBoundsException e) 
+      {
+        pass = true;
+      }
+      harness.check(pass);
+    }
+}
Index: getOffset.java
===================================================================
RCS file: getOffset.java
diff -N getOffset.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getOffset.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,49 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.java.awt.image.DataBuffer;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferInt;
+
+/**
+ * Some checks for the getOffset() method in the {@link DataBuffer} class.
+ */
+public class getOffset implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    // check simple case
+    DataBuffer b1 = new DataBufferInt(new int[] {1, 2, 3}, 3, 1);
+    harness.check(b1.getOffset() == 1);
+
+    // check that offset reflects setting in array
+    DataBuffer b2 = new DataBufferInt(new int[][] {{1, 2, 3, 4}, {5, 6, 7, 8}}, 2, new int[] {1 , 2});
+    harness.check(b2.getOffset() == 1);
+  }
+
+}
Index: getOffsets.java
===================================================================
RCS file: getOffsets.java
diff -N getOffsets.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getOffsets.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,47 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.java.awt.image.DataBuffer;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferInt;
+
+/**
+ * Some checks for the getOffsets() method in the {@link DataBuffer} class.
+ */
+public class getOffsets implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    // 
+    DataBuffer b1 = new DataBufferInt(new int[] {1, 2, 3}, 3, 1);
+    int[] offsets = b1.getOffsets();
+    harness.check(offsets.length == 1);
+    harness.check(offsets[0] == 1);
+  }
+
+}
Index: getDataType.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/DataBufferShort/getDataType.java,v
retrieving revision 1.1
diff -u -r1.1 getDataType.java
--- getDataType.java	14 Apr 2004 11:33:35 -0000	1.1
+++ getDataType.java	1 Sep 2004 21:26:52 -0000
@@ -21,8 +21,8 @@
 
 package gnu.testlet.java.awt.image.DataBufferShort;
 
-import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
 
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferShort;
Index: getElem.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/DataBufferShort/getElem.java,v
retrieving revision 1.1
diff -u -r1.1 getElem.java
--- getElem.java	14 Apr 2004 11:33:35 -0000	1.1
+++ getElem.java	1 Sep 2004 21:26:53 -0000
@@ -21,8 +21,8 @@
 
 package gnu.testlet.java.awt.image.DataBufferShort;
 
-import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
 
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferShort;
@@ -48,5 +48,151 @@
     h.check(buf.getElem(0, 1), -44); // Check #4.
     h.check(buf.getElem(1, 0), -11); // Check #5.
     h.check(buf.getElem(1, 1), -22); // Check #6.
+    
+    // new tests added by David Gilbert
+    testGetElem1(h);
+    testGetElem2(h);
+    
+  }
+  
+  private void testGetElem1(TestHarness harness) 
+  {
+    harness.checkPoint("getElem(int)");  
+      
+    // test where supplied array is bigger than 'size'
+    short[] source = new short[] {1, 2, 3};
+    DataBufferShort b = new DataBufferShort(source, 2);
+    harness.check(b.getElem(0) == 1);
+    harness.check(b.getElem(1) == 2);
+    harness.check(b.getElem(2) == 3);
+    
+    boolean pass = false;
+    try
+    {
+      b.getElem(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test where offsets are specified
+    source = new short[] {1, 2, 3, 4};
+    b = new DataBufferShort(source, 2, 1);
+    harness.check(b.getElem(-1) == 1);
+    harness.check(b.getElem(0) == 2);
+    harness.check(b.getElem(1) == 3);
+    harness.check(b.getElem(2) == 4);
+
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try
+    {
+      b.getElem(-2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testGetElem2(TestHarness harness) {
+    harness.checkPoint("getElem(int, int)");  
+    
+    short[][] source = new short[][] {{1, 2}, {3, 4}};
+    DataBufferShort b = new DataBufferShort(source, 2);
+    harness.check(b.getElem(1, 0) == 3);
+    harness.check(b.getElem(1, 1) == 4);
+    
+    // test where supplied array is bigger than 'size'
+    source = new short[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferShort(source, 2);
+    harness.check(b.getElem(1, 2) == 6);
+      
+    // test where offsets are specified
+    source = new short[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferShort(source, 2, new int[] {1, 2});
+    harness.check(b.getElem(1, -2) == 5);
+    harness.check(b.getElem(1, -1) == 6);
+    harness.check(b.getElem(1, 0) == 7);
+    harness.check(b.getElem(1, 1) == 8);
+       
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(source[1][2] == 99);
+    harness.check(b.getElem(1, 0) == 99);
+        
+    // test when the bank index is out of bounds
+    boolean pass = true;
+    try
+    {
+      b.getElem(-1, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(2, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test when the item index is out of bounds
+    pass = true;
+    try
+    {
+      b.getElem(0, -2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(1, 5);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // the array of arrays should reflect the single dimension array
+    DataBufferShort b2 = new DataBufferShort(new short[] {1, 2, 3}, 3);
+    harness.check(b2.getElem(0, 1) == 2);
   }
 }
Index: constructors.java
===================================================================
RCS file: constructors.java
diff -N constructors.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ constructors.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,250 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.java.awt.image.DataBufferShort;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferShort;
+
+/**
+ * Some tests for the constructors in the {@link DataBufferShort} class.
+ */
+public class constructors implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testConstructor1(harness);
+    testConstructor2(harness);
+    testConstructor3(harness);
+    testConstructor4(harness);
+    testConstructor5(harness);
+    testConstructor6(harness);
+  }
+
+  private void testConstructor1(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferShort(int)");
+    DataBufferShort b1 = new DataBufferShort(1);
+    harness.check(b1.getDataType() == DataBuffer.TYPE_SHORT);
+    harness.check(b1.getSize() == 1);
+    harness.check(b1.getNumBanks() == 1);
+    harness.check(b1.getOffset() == 0);
+  
+    DataBufferShort b2 = new DataBufferShort(0);
+    harness.check(b2.getSize() == 0);
+    harness.check(b2.getNumBanks() == 1);
+    harness.check(b2.getOffset() == 0);
+  
+    boolean pass = false;
+    try 
+    {
+        DataBufferShort b3 = new DataBufferShort(-1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass); 
+  }
+
+  private void testConstructor2(TestHarness harness)  
+  {
+    harness.checkPoint("DataBufferShort(short[][], int)");
+    short[][] source = new short[][] {{1, 2}};
+    DataBufferShort b = new DataBufferShort(source, 1);
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+  
+    // does a change to the source array affect the buffer? yes
+    short[][] banks = b.getBankData();
+    harness.check(banks[0][0] == 1);
+    source[0][0] = 3;
+    harness.check(banks[0][0] == 3);
+  
+    // check null source
+    boolean pass = false;
+    try 
+    {
+        DataBufferShort b1 = new DataBufferShort((short[][]) null, 1);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+    // check negative size
+    DataBufferShort b1 = new DataBufferShort(source, -1);
+    harness.check(b1.getSize() == -1);
+  }
+
+  private void testConstructor3(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferShort(short[][], int, int[])");
+    short[][] source = new short[][] {{1, 2}};
+    DataBufferShort b = new DataBufferShort(source, 1, new int[] {0});
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    // test where offsets are specified
+    source = new short[][] {{1, 2, 3}, {4, 5, 6, 7}};
+    b = new DataBufferShort(source, 2, new int[] {0, 1});
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 2);
+    harness.check(b.getOffsets()[1] == 1);
+    harness.check(b.getElem(1, 0) == 5);
+
+    boolean pass = false;
+    try 
+    {
+      DataBufferShort b1 = new DataBufferShort((short[][]) null, 1, new int[] {0});
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+    pass = false;
+    try 
+    {
+      DataBufferShort b1 = new DataBufferShort(new short[][]{{1, 2}}, 1, (int[]) null);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+    pass = false;
+    try
+    {
+      DataBufferShort b2 = new DataBufferShort(new short[][]{{1, 2}}, 1, new int[] {0, 0});
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+  }
+
+  private void testConstructor4(TestHarness harness)  
+  {
+    harness.checkPoint("DataBufferShort(short[], int)");
+    DataBufferShort b = new DataBufferShort(new short[] {1, 2}, 2);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+   
+    boolean pass = false;
+    try 
+    {
+      // this constructor doesn't throw an exception until you
+      // try to access the (null) data bank
+      DataBufferShort b1 = new DataBufferShort((short[]) null, 1);
+      int ignore = b1.getElem(0);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testConstructor5(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferShort(short[], int, int)");
+    DataBufferShort b = new DataBufferShort(new short[] {1, 2}, 2, 0);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+  
+    boolean pass = false;
+    try 
+    {
+      // this constructor doesn't throw an exception until you
+      // try to access the (null) data bank
+      DataBufferShort b1 = new DataBufferShort((short[]) null, 1, 0);
+      int ignore = b1.getElem(0);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // does negative size fail? no
+    pass = true;
+    try 
+    {
+      DataBufferShort b2 = new DataBufferShort(new short[] {1, 2}, -1, 0);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = false;
+    }
+    harness.check(pass);  
+  }
+
+  private void testConstructor6(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferShort(int, int)");
+    DataBufferShort b = new DataBufferShort(2, 3);
+    harness.check(b.getNumBanks() == 3);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getOffset() == 0);
+  
+    // does negative size fail? yes
+    boolean pass = false;
+    try 
+    {
+      DataBufferShort b1 = new DataBufferShort(-1, 1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    } 
+    harness.check(pass);
+
+    // does negative banks fail? yes
+    pass = false;
+    try 
+    {
+      DataBufferShort b1 = new DataBufferShort(1, -1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: getBankData.java
===================================================================
RCS file: getBankData.java
diff -N getBankData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getBankData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,78 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferShort;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferShort;
+import java.util.Arrays;
+
+/**
+ * Some tests for the getBankData() method in the {@link DataBufferShort} class.
+ */
+public class getBankData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    // check that array updates pass through
+    short[][] data = new short[][] {{1, 2}};
+    DataBufferShort b = new DataBufferShort(data, 2);
+    short[][] banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+    data[0][0] = 3;
+    harness.check(banks[0][0] == 3);
+
+    // test where supplied array is bigger than 'size'
+    data = new short[][] {{1, 2, 3}};
+    b = new DataBufferShort(data, 2);
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+
+    // test where offsets are specified
+    data = new short[][] {{1, 2, 3}, {4, 5, 6, 7}};
+    b = new DataBufferShort(data, 2, new int[] {0, 1});
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+
+    // check that a single bank buffer returns a valid array
+    DataBufferShort b2 = new DataBufferShort(new short[] {1, 2}, 2);
+    banks = b2.getBankData();
+    harness.check(banks.length == 1);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[0][1] == 2);
+
+    // check that a multi bank buffer returns a valid array
+    DataBufferShort b3 = new DataBufferShort(new short[][] {{1}, {2}}, 1);
+    banks = b3.getBankData();
+    harness.check(banks.length == 2);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[1][0] == 2);
+}
+
+}
Index: getData.java
===================================================================
RCS file: getData.java
diff -N getData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,138 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferShort;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferShort;
+
+/**
+ * Some tests for the geData() methods in the {@link DataBufferShort} class.
+ */
+public class getData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testGetData1(harness);
+    testGetData2(harness);
+  }
+
+  private void testGetData1(TestHarness harness) {
+    harness.checkPoint("getData()");  
+  
+    // check simple case
+    short[] source = new short[] {1, 2};
+    DataBufferShort b = new DataBufferShort(source, 2);
+    short[] data = b.getData();
+    harness.check(data.length == 2);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+
+    // test where supplied array is bigger than 'size'
+    source = new short[] {1, 2, 3};
+    b = new DataBufferShort(source, 2);
+    data = b.getData();
+    harness.check(data.length == 3);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+
+    // test where offsets are specified
+    source = new short[] {1, 2, 3, 4};
+    b = new DataBufferShort(source, 2, 1);
+    data = b.getData();
+    harness.check(data.length == 4);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+    harness.check(data[3] == 4);
+  
+    // does a change to the source affect the DataBuffer? Yes
+    source[2] = 99;
+    harness.check(data[2] == 99);
+  }
+
+  private void testGetData2(TestHarness harness) {
+    harness.checkPoint("getData(int)");  
+    
+    short[][] source = new short[][] {{1, 2}, {3, 4}};
+    DataBufferShort b = new DataBufferShort(source, 2);
+    short[] data = b.getData(1);
+    harness.check(data.length == 2);
+    harness.check(data[0] == 3);
+    harness.check(data[1] == 4);
+    
+    // test where supplied array is bigger than 'size'
+    source = new short[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferShort(source, 2);
+    data = b.getData(1);
+    harness.check(data.length == 3);
+    harness.check(data[0] == 4);
+    harness.check(data[1] == 5);
+    harness.check(data[2] == 6);
+  
+    // test where offsets are specified
+    source = new short[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferShort(source, 2, new int[] {1, 2});
+    data = b.getData(1);
+    harness.check(data.length == 4);
+    harness.check(data[0] == 5);
+    harness.check(data[1] == 6);
+    harness.check(data[2] == 7);
+    harness.check(data[3] == 8);
+    
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(data[2] == 99);
+    
+    // check bounds exceptions
+    boolean pass = true;
+    try
+    {
+      b.getData(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try 
+    {
+      b.getData(2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: setElem.java
===================================================================
RCS file: setElem.java
diff -N setElem.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ setElem.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,120 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferShort;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferShort;
+
+/**
+ * Some tests for the setElem() methods in the {@link DataBufferShort} class.
+ */
+public class setElem implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testSetElem1(harness);
+    testSetElem2(harness); 
+  }
+
+  private void testSetElem1(TestHarness harness) {
+    harness.checkPoint("setElem(int, int)");  
+
+    short[] source = new short[] {1, 2};
+    DataBufferShort b = new DataBufferShort(source, 2);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99);
+  
+    // does the source array get updated? Yes
+    harness.check(source[1] == 99);
+
+    // test with offsets
+    source = new short[] {1, 2, 3, 4, 5};
+    b = new DataBufferShort(source, 4, 1);
+    harness.check(b.getElem(1) == 3);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99); 
+    harness.check(source[2] == 99);
+  
+    boolean pass = false;
+    try
+    {
+      b.setElem(-2, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+    pass = false;
+    try
+    {
+      b.setElem(4, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testSetElem2(TestHarness harness) {
+    harness.checkPoint("setElem(int, int, int)");  
+  
+    short[][] source = new short[][] {{1, 2}, {3, 4}};
+    DataBufferShort b = new DataBufferShort(source, 2);
+    b.setElem(1, 1, 99);
+    harness.check(b.getElem(1, 1) == 99);
+    // does the source array get updated?
+    harness.check(source[1][1] == 99);
+
+    boolean pass = false;
+    try
+    {
+      b.setElem(-1, 1, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try
+    {
+      b.setElem(2, 1, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: getDataType.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/DataBufferUShort/getDataType.java,v
retrieving revision 1.1
diff -u -r1.1 getDataType.java
--- getDataType.java	14 Apr 2004 11:33:35 -0000	1.1
+++ getDataType.java	1 Sep 2004 21:27:21 -0000
@@ -21,8 +21,8 @@
 
 package gnu.testlet.java.awt.image.DataBufferUShort;
 
-import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
 
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferUShort;
Index: getElem.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/image/DataBufferUShort/getElem.java,v
retrieving revision 1.1
diff -u -r1.1 getElem.java
--- getElem.java	14 Apr 2004 11:33:35 -0000	1.1
+++ getElem.java	1 Sep 2004 21:27:21 -0000
@@ -21,8 +21,8 @@
 
 package gnu.testlet.java.awt.image.DataBufferUShort;
 
-import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
 
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferUShort;
@@ -48,5 +48,150 @@
     h.check(buf.getElem(0, 1), 0x10000 - 44); // Check #4.
     h.check(buf.getElem(1, 0), 0x10000 - 11); // Check #5.
     h.check(buf.getElem(1, 1), 0x10000 - 22); // Check #6.
+    // new tests added by David Gilbert
+    testGetElem1(h);
+    testGetElem2(h);
+    
+  }
+  
+  private void testGetElem1(TestHarness harness) 
+  {
+    harness.checkPoint("getElem(int)");  
+      
+    // test where supplied array is bigger than 'size'
+    short[] source = new short[] {1, 2, 3};
+    DataBufferUShort b = new DataBufferUShort(source, 2);
+    harness.check(b.getElem(0) == 1);
+    harness.check(b.getElem(1) == 2);
+    harness.check(b.getElem(2) == 3);
+    
+    boolean pass = false;
+    try
+    {
+      b.getElem(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test where offsets are specified
+    source = new short[] {1, 2, 3, 4};
+    b = new DataBufferUShort(source, 2, 1);
+    harness.check(b.getElem(-1) == 1);
+    harness.check(b.getElem(0) == 2);
+    harness.check(b.getElem(1) == 3);
+    harness.check(b.getElem(2) == 4);
+
+    pass = false;
+    try
+    {
+      b.getElem(3);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try
+    {
+      b.getElem(-2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testGetElem2(TestHarness harness) {
+    harness.checkPoint("getElem(int, int)");  
+    
+    short[][] source = new short[][] {{1, 2}, {3, 4}};
+    DataBufferUShort b = new DataBufferUShort(source, 2);
+    harness.check(b.getElem(1, 0) == 3);
+    harness.check(b.getElem(1, 1) == 4);
+    
+    // test where supplied array is bigger than 'size'
+    source = new short[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferUShort(source, 2);
+    harness.check(b.getElem(1, 2) == 6);
+      
+    // test where offsets are specified
+    source = new short[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferUShort(source, 2, new int[] {1, 2});
+    harness.check(b.getElem(1, -2) == 5);
+    harness.check(b.getElem(1, -1) == 6);
+    harness.check(b.getElem(1, 0) == 7);
+    harness.check(b.getElem(1, 1) == 8);
+       
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(source[1][2] == 99);
+    harness.check(b.getElem(1, 0) == 99);
+        
+    // test when the bank index is out of bounds
+    boolean pass = true;
+    try
+    {
+      b.getElem(-1, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(2, 0);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // test when the item index is out of bounds
+    pass = true;
+    try
+    {
+      b.getElem(0, -2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+        
+    pass = false;
+    try 
+    {
+      b.getElem(1, 5);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+    
+    // the array of arrays should reflect the single dimension array
+    DataBufferUShort b2 = new DataBufferUShort(new short[] {1, 2, 3}, 3);
+    harness.check(b2.getElem(0, 1) == 2);
   }
 }
Index: constructors.java
===================================================================
RCS file: constructors.java
diff -N constructors.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ constructors.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,248 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.  */
+
+package gnu.testlet.java.awt.image.DataBufferUShort;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferUShort;
+
+/**
+ * Some tests for the constructors in the {@link DataBufferUShort} class.
+ */
+public class constructors implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testConstructor1(harness);
+    testConstructor2(harness);
+    testConstructor3(harness);
+    testConstructor4(harness);
+    testConstructor5(harness);
+    testConstructor6(harness);
+  }
+
+  private void testConstructor1(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferUShort(int)");
+    DataBufferUShort b1 = new DataBufferUShort(1);
+    harness.check(b1.getDataType() == DataBuffer.TYPE_USHORT);
+    harness.check(b1.getSize() == 1);
+    harness.check(b1.getNumBanks() == 1);
+    harness.check(b1.getOffset() == 0);
+
+    DataBufferUShort b2 = new DataBufferUShort(0);
+    harness.check(b2.getSize() == 0);
+    harness.check(b2.getNumBanks() == 1);
+    harness.check(b2.getOffset() == 0);
+
+   boolean pass = false;
+    try 
+    {
+        DataBufferUShort b3 = new DataBufferUShort(-1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass); 
+  }
+
+  private void testConstructor2(TestHarness harness)  
+  {
+    harness.checkPoint("DataBufferShort(short[][], int)");
+    short[][] source = new short[][] {{1, 2}};
+    DataBufferUShort b = new DataBufferUShort(source, 1);
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    // does a change to the source array affect the buffer? yes
+    short[][] banks = b.getBankData();
+    harness.check(banks[0][0] == 1);
+    source[0][0] = 3;
+    harness.check(banks[0][0] == 3);
+
+    // check null source
+    boolean pass = false;
+    try 
+    {
+        DataBufferUShort b1 = new DataBufferUShort((short[][]) null, 1);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // check negative size
+    DataBufferUShort b1 = new DataBufferUShort(source, -1);
+    harness.check(b1.getSize() == -1);
+  }
+
+  private void testConstructor3(TestHarness harness)   
+  {
+    harness.checkPoint("DataBufferUShort(short[][], int, int[])");
+    short[][] source = new short[][] {{1, 2}};
+    DataBufferUShort b = new DataBufferUShort(source, 1, new int[] {0});
+    harness.check(b.getSize() == 1);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    // test where offsets are specified
+    source = new short[][] {{1, 2, 3}, {4, 5, 6, 7}};
+    b = new DataBufferUShort(source, 2, new int[] {0, 1});
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 2);
+    harness.check(b.getOffsets()[1] == 1);
+    harness.check(b.getElem(1, 0) == 5);
+
+    boolean pass = false;
+    try 
+    {
+      DataBufferUShort b1 = new DataBufferUShort((short[][]) null, 1, new int[] {0});
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try 
+    {
+       DataBufferUShort b1 = new DataBufferUShort(new short[][]{{1, 2}}, 1, (int[]) null);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try
+    {
+      DataBufferUShort b2 = new DataBufferUShort(new short[][]{{1, 2}}, 1, new int[] {0, 0});
+    }
+    catch (ArrayIndexOutOfBoundsException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+  }
+
+  private void testConstructor4(TestHarness harness)  
+  {
+    harness.checkPoint("DataBufferUShort(short[], int)");
+    DataBufferUShort b = new DataBufferUShort(new short[] {1, 2}, 2);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0); 
+ 
+    // this constructor, unlike all the other DataBuffer classes, rejects
+    // a null bank
+    boolean pass = false;
+    try 
+    {
+      DataBufferUShort b1 = new DataBufferUShort((short[]) null, 1);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testConstructor5(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferUShort(short[], int, int)");
+    DataBufferUShort b = new DataBufferUShort(new short[] {1, 2}, 2, 0);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getNumBanks() == 1);
+    harness.check(b.getOffset() == 0);
+
+    // this constructor, unlike all the other DataBuffer classes, rejects
+    // a null bank
+    boolean pass = false;
+    try 
+    {
+      DataBufferUShort b1 = new DataBufferUShort((short[]) null, 1, 0);
+    }
+    catch (NullPointerException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    // does negative size fail? no
+    pass = true;
+    try 
+    {
+      DataBuffer b1 = new DataBufferUShort(new short[] {1, 2}, -1, 0);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = false;
+    }
+    harness.check(pass);  
+  }
+
+  private void testConstructor6(TestHarness harness) 
+  {
+    harness.checkPoint("DataBufferUShort(int, int)");
+    DataBufferUShort b = new DataBufferUShort(2, 3);
+    harness.check(b.getNumBanks() == 3);
+    harness.check(b.getSize() == 2);
+    harness.check(b.getOffset() == 0);
+
+    // does negative size fail? yes
+    boolean pass = false;
+    try 
+    {
+      DataBufferUShort b1 = new DataBufferUShort(-1, 1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    } 
+    harness.check(pass);
+
+    // does negative banks fail? yes
+    pass = false;
+    try 
+    {
+      DataBufferUShort b1 = new DataBufferUShort(1, -1);
+    }
+    catch (NegativeArraySizeException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: getBankData.java
===================================================================
RCS file: getBankData.java
diff -N getBankData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getBankData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,78 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferUShort;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferUShort;
+import java.util.Arrays;
+
+/**
+ * Some tests for the getBankData() method in the {@link DataBufferUShort} class.
+ */
+public class getBankData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    // check that array updates pass through
+    short[][] data = new short[][] {{1, 2}};
+    DataBufferUShort b = new DataBufferUShort(data, 2);
+    short[][] banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+    data[0][0] = 3;
+    harness.check(banks[0][0] == 3);
+
+    // test where supplied array is bigger than 'size'
+    data = new short[][] {{1, 2, 3}};
+    b = new DataBufferUShort(data, 2);
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+
+    // test where offsets are specified
+    data = new short[][] {{1, 2, 3}, {4, 5, 6, 7}};
+    b = new DataBufferUShort(data, 2, new int[] {0, 1});
+    banks = b.getBankData();
+    harness.check(Arrays.equals(b.getBankData(), data));
+
+    // check that a single bank buffer returns a valid array
+    DataBufferUShort b2 = new DataBufferUShort(new short[] {1, 2}, 2);
+    banks = b2.getBankData();
+    harness.check(banks.length == 1);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[0][1] == 2);
+
+    // check that a multi bank buffer returns a valid array
+    DataBufferUShort b3 = new DataBufferUShort(new short[][] {{1}, {2}}, 1);
+    banks = b3.getBankData();
+    harness.check(banks.length == 2);
+    harness.check(banks[0][0] == 1);
+    harness.check(banks[1][0] == 2);
+  }
+
+}
Index: getData.java
===================================================================
RCS file: getData.java
diff -N getData.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ getData.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,138 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferUShort;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferUShort;
+
+/**
+ * Some tests for the geData() methods in the {@link DataBufferUShort} class.
+ */
+public class getData implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testGetData1(harness);
+    testGetData2(harness);
+  }
+
+  private void testGetData1(TestHarness harness) {
+    harness.checkPoint("getData()");  
+
+    // check simple case
+    short[] source = new short[] {1, 2};
+    DataBufferUShort b = new DataBufferUShort(source, 2);
+    short[] data = b.getData();
+    harness.check(data.length == 2);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+
+    // test where supplied array is bigger than 'size'
+    source = new short[] {1, 2, 3};
+    b = new DataBufferUShort(source, 2);
+    data = b.getData();
+    harness.check(data.length == 3);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+
+    // test where offsets are specified
+    source = new short[] {1, 2, 3, 4};
+    b = new DataBufferUShort(source, 2, 1);
+    data = b.getData();
+    harness.check(data.length == 4);
+    harness.check(data[0] == 1);
+    harness.check(data[1] == 2);
+    harness.check(data[2] == 3);
+    harness.check(data[3] == 4);
+
+    // does a change to the source affect the DataBuffer? Yes
+    source[2] = 99;
+    harness.check(data[2] == 99);
+  }
+
+  private void testGetData2(TestHarness harness) {
+    harness.checkPoint("getData(int)");  
+  
+    short[][] source = new short[][] {{1, 2}, {3, 4}};
+    DataBufferUShort b = new DataBufferUShort(source, 2);
+    short[] data = b.getData(1);
+    harness.check(data.length == 2);
+    harness.check(data[0] == 3);
+    harness.check(data[1] == 4);
+  
+    // test where supplied array is bigger than 'size'
+    source = new short[][] {{1, 2, 3}, {4, 5, 6}};
+    b = new DataBufferUShort(source, 2);
+    data = b.getData(1);
+    harness.check(data.length == 3);
+    harness.check(data[0] == 4);
+    harness.check(data[1] == 5);
+    harness.check(data[2] == 6);
+
+    // test where offsets are specified
+    source = new short[][] {{1, 2, 3, 4}, {5, 6, 7, 8}};
+    b = new DataBufferUShort(source, 2, new int[] {1, 2});
+    data = b.getData(1);
+    harness.check(data.length == 4);
+    harness.check(data[0] == 5);
+    harness.check(data[1] == 6);
+    harness.check(data[2] == 7);
+    harness.check(data[3] == 8);
+  
+    // does a change to the source affect the DataBuffer? Yes
+    source[1][2] = 99;
+    harness.check(data[2] == 99);
+  
+    // check bounds exceptions
+    boolean pass = true;
+    try
+    {
+      b.getData(-1);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+    pass = false;
+    try 
+    {
+      b.getData(2);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: setElem.java
===================================================================
RCS file: setElem.java
diff -N setElem.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ setElem.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,120 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+//This file is part of Mauve.
+
+//Mauve is free software; you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation; either version 2, or (at your option)
+//any later version.
+
+//Mauve is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Mauve; see the file COPYING.  If not, write to
+//the Free Software Foundation, 59 Temple Place - Suite 330,
+//Boston, MA 02111-1307, USA.
+
+package gnu.testlet.java.awt.image.DataBufferUShort;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.image.DataBufferUShort;
+
+/**
+ * Some tests for the setElem() methods in the {@link DataBufferUShort} class.
+ */
+public class setElem implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)      
+  {
+    testSetElem1(harness);
+    testSetElem2(harness); 
+  }
+
+  private void testSetElem1(TestHarness harness) {
+    harness.checkPoint("setElem(int, int)");   
+
+    short[] source = new short[] {1, 2};
+    DataBufferUShort b = new DataBufferUShort(source, 2);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99);
+
+    // does the source array get updated? Yes
+    harness.check(source[1] == 99);
+
+    // test with offsets
+    source = new short[] {1, 2, 3, 4, 5};
+    b = new DataBufferUShort(source, 4, 1);
+    harness.check(b.getElem(1) == 3);
+    b.setElem(1, 99);
+    harness.check(b.getElem(1) == 99); 
+    harness.check(source[2] == 99);
+
+    boolean pass = false;
+    try
+    {
+      b.setElem(-2, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+
+    pass = false;
+    try
+    {
+      b.setElem(4, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+  private void testSetElem2(TestHarness harness) {
+    harness.checkPoint("setElem(int, int, int)");  
+
+    short[][] source = new short[][] {{1, 2}, {3, 4}};
+    DataBufferUShort b = new DataBufferUShort(source, 2);
+    b.setElem(1, 1, 99);
+    harness.check(b.getElem(1, 1) == 99);
+    // does the source array get updated?
+    harness.check(source[1][1] == 99);
+
+    boolean pass = false;
+    try
+    {
+      b.setElem(-1, 1, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException e) 
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  
+    pass = false;
+    try
+    {
+      b.setElem(2, 1, 99);
+    }
+    catch (ArrayIndexOutOfBoundsException 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]