public void test(TestHarness harness)
{
DataBuffer db = new DataBufferInt(12);
for (int i = 0; i < 12; i++)
db.setElem(i, i);
ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_INT,
3, 2, 2, 6, new int[] {0, 1});
int[] pixels = m.getPixels(1, 0, 2, 1, (int[]) null, db);
harness.check(pixels.length, 4);
harness.check(pixels[0], 2);
harness.check(pixels[1], 3);
harness.check(pixels[2], 4);
harness.check(pixels[3], 5);
// try passing in a result array
int[] result = new int[4];
pixels = m.getPixels(1, 1, 2, 1, result, db);
harness.check(pixels[0], 8);
harness.check(pixels[1], 9);
harness.check(pixels[2], 10);
harness.check(pixels[3], 11);
harness.check(pixels == result);
// try null data buffer
boolean pass = false;
try
{
m.getPixels(1, 1, 2, 1, result, null);
}
catch (NullPointerException e)
{
pass = true;
}