mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-04 03:55:28 -04:00
#400 Added test case for the V3 with no palette case.
This commit is contained in:
parent
39277697a6
commit
d02d45f95a
@ -68,6 +68,7 @@ public class PCXImageReaderTest extends ImageReaderAbstractTest<PCXImageReader>
|
||||
new TestData(getClassLoaderResource("/pcx/lena9.pcx"), new Dimension(512, 512)), // RLE encoded, 2 color indexed (1 bps/1 channel)
|
||||
new TestData(getClassLoaderResource("/pcx/lena10.pcx"), new Dimension(512, 512)), // RLE encoded, 16 color indexed (4 bps/1 channel) (uses only 8 colors)
|
||||
new TestData(getClassLoaderResource("/pcx/DARKSTAR.PCX"), new Dimension(88, 52)), // RLE encoded monochrome (1 bps/1 channel)
|
||||
new TestData(getClassLoaderResource("/pcx/no-palette-monochrome.pcx"), new Dimension(128, 152)), // RLE encoded monochrome (1 bps/1 channel)
|
||||
// See cga-pcx.txt, however, the text seems to be in error, the bits can not not as described
|
||||
new TestData(getClassLoaderResource("/pcx/CGA_BW.PCX"), new Dimension(640, 200)), // RLE encoded indexed (CGA mode)
|
||||
new TestData(getClassLoaderResource("/pcx/CGA_FSD.PCX"), new Dimension(320, 200)), // RLE encoded indexed (CGA mode)
|
||||
@ -131,6 +132,29 @@ public class PCXImageReaderTest extends ImageReaderAbstractTest<PCXImageReader>
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadMonochromeNoPalette() throws IOException {
|
||||
// Monochrome image V3 (no palette), palette is all 0's
|
||||
try (ImageInputStream input = ImageIO.createImageInputStream(getClassLoaderResource("/pcx/no-palette-monochrome.pcx"))) {
|
||||
PCXImageReader reader = createReader();
|
||||
reader.setInput(input);
|
||||
|
||||
assertEquals(1, reader.getNumImages(true));
|
||||
assertEquals(128, reader.getWidth(0));
|
||||
assertEquals(152, reader.getHeight(0));
|
||||
|
||||
BufferedImage image = reader.read(0);
|
||||
|
||||
assertNotNull(image);
|
||||
assertEquals(BufferedImage.TYPE_BYTE_BINARY, image.getType());
|
||||
assertEquals(128, image.getWidth());
|
||||
assertEquals(152, image.getHeight());
|
||||
|
||||
assertRGBEquals("Should have white background", 0xffffffff, image.getRGB(0, 0), 0);
|
||||
assertRGBEquals("Should have black skull", 0xff000000, image.getRGB(64, 10), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadWithSourceRegionParamEqualImage() throws IOException {
|
||||
TestData data = getTestData().get(1);
|
||||
|
BIN
imageio/imageio-pcx/src/test/resources/pcx/no-palette-monochrome.pcx
Executable file
BIN
imageio/imageio-pcx/src/test/resources/pcx/no-palette-monochrome.pcx
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user