}
public void testBitMapInfo1()
{
{
BitMapInfo b = new BitMapInfo();
assertEquals(b.biBitCount, 24);
assertEquals(b.biWidth, 0);
assertEquals(b.biHeight, 0);
assertEquals(b.biPlanes, 1);
assertEquals(b.biSizeImage, 0);
assertEquals(b.fourcc, "");
assertEquals(b.biXPelsPerMeter, 0);
assertEquals(b.biYPelsPerMeter, 0);
assertEquals(b.biClrUsed, 0);
assertEquals(b.biClrImportant, 0);
assertEquals(b.extraSize, 0);
assertEquals(b.extraBytes, null);
assertEquals(b.toString(), "Size = 0 x 0 Planes = 1 BitCount = 24 FourCC = SizeImage = 0\nClrUsed = 0\nClrImportant = 0\nExtraSize = 0\n");
test(b);
final String[] fourccs = new String[]{"", "xyzq", "RGB", "YV12"};
final byte[][] extras = new byte[][]{null, new byte[]{11, 12}};
final int[] bitcounts = new int[] {8, 12, 16, 24, 32};//, 16, 24, 32};
final int[] sizes = new int[] {0, 1, 2, 3, 6, 12};
for (int k = 0; k < bitcounts.length; ++k)
for (b.biWidth = 0; b.biWidth < 3; ++b.biWidth)
for (b.biHeight = 0; b.biHeight < 3; ++b.biHeight)
for (b.biPlanes = 0; b.biPlanes <= 2; ++b.biPlanes)
//for (b.biSizeImage = 0; b.biSizeImage < 3; ++b.biSizeImage)
for (int m = 0; m < sizes.length; ++m)
for (int j = 0; j < extras.length; ++j)
for (b.biXPelsPerMeter = 0; b.biXPelsPerMeter < 2; ++b.biXPelsPerMeter)
for (b.biYPelsPerMeter = 0; b.biYPelsPerMeter < 2; ++b.biYPelsPerMeter)
for (b.biClrUsed = 0; b.biClrUsed < 2; ++b.biClrUsed)
for (b.biClrImportant = 0; b.biClrImportant < 3; ++b.biClrImportant)
for (b.extraSize = 0; b.extraSize < 2; ++b.extraSize)
for (int i = 0; i < fourccs.length; ++i)
{
b.biBitCount = bitcounts[k];
b.fourcc = fourccs[i];
b.extraBytes = extras[j];
b.biSizeImage = sizes[m];
test(b);
{
BitMapInfo b2 = new BitMapInfo(b.fourcc, b.biWidth, b.biHeight);
assertEquals(b2.biBitCount, 24);
assertEquals(b2.biWidth, b.biWidth);
assertEquals(b2.biHeight, b.biHeight);
assertEquals(b2.biPlanes, 1);
if (b2.fourcc.equals("RGB"))
assertEquals(b2.biSizeImage, b2.biWidth * b2.biHeight * (b2.biBitCount / 8)); // TODO
else
assertEquals(b2.biSizeImage, 0);
assertEquals(b2.fourcc, b.fourcc);
assertEquals(b2.biXPelsPerMeter, 0);
assertEquals(b2.biYPelsPerMeter, 0);
assertEquals(b2.biClrUsed, 0);
assertEquals(b2.biClrImportant, 0);
assertEquals(b2.extraSize, 0);
assertEquals(b2.extraBytes, null);
test(b2);
}
{
BitMapInfo b2 = new BitMapInfo(b.fourcc, b.biWidth, b.biHeight, b.biPlanes, b.biBitCount, b.biSizeImage, b.biClrUsed, b.biClrImportant);
assertEquals(b2.biBitCount, b.biBitCount);
assertEquals(b2.biWidth, b.biWidth);
assertEquals(b2.biHeight, b.biHeight);
assertEquals(b2.biPlanes, b.biPlanes);
assertEquals(b2.biSizeImage, b.biSizeImage);