private void testConstructor3(TestHarness harness)
{
harness.checkPoint("DirectColorModel(int, int, int, int, int)");
// first an 8 bit model
DirectColorModel m1 = new DirectColorModel(8, 0xC0, 0x30, 0x0C, 0x03);
harness.check(m1.getPixelSize(), 8);
harness.check(m1.getComponentSize(0), 2);
harness.check(m1.getComponentSize(1), 2);
harness.check(m1.getComponentSize(2), 2);
harness.check(m1.getComponentSize(3), 2);
harness.check(m1.getTransparency(), Transparency.TRANSLUCENT);
harness.check(m1.getTransferType(), DataBuffer.TYPE_BYTE);
// 16 bit model
DirectColorModel m2 = new DirectColorModel(16, 0xF000, 0x0F00, 0xF0, 0x0F);
harness.check(m2.getPixelSize(), 16);
harness.check(m2.getComponentSize(0), 4);
harness.check(m2.getComponentSize(1), 4);
harness.check(m2.getComponentSize(2), 4);
harness.check(m2.getComponentSize(3), 4);
harness.check(m2.getTransparency(), Transparency.TRANSLUCENT);
harness.check(m2.getTransferType(), DataBuffer.TYPE_USHORT);
// 32 bit model
DirectColorModel m3 = new DirectColorModel(32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF);
harness.check(m3.getPixelSize(), 32);
harness.check(m3.getComponentSize(0), 8);
harness.check(m3.getComponentSize(1), 8);
harness.check(m3.getComponentSize(2), 8);
harness.check(m3.getComponentSize(3), 8);
harness.check(m3.getTransparency(), Transparency.TRANSLUCENT);
harness.check(m3.getTransferType(), DataBuffer.TYPE_INT);
// check negative bits
boolean pass = false;
try
{
/* ColorModel m = */ new DirectColorModel(-1, 0xFF000000, 0xFF0000, 0xFF00, 0xFF);
}
catch (IllegalArgumentException e)
{
pass = true;
}
harness.check(pass);
// check bits > 32
pass = false;
try
{
/* ColorModel m = */ new DirectColorModel(33, 0xFF000000, 0xFF0000, 0xFF00, 0xFF);
}
catch (IllegalArgumentException e)
{
pass = true;
}