TMI-TIFF: Test case for CCITT modified huffman (type 2), source region support for JPEG and tiled images + minor bug fixes.

This commit is contained in:
Harald Kuhr
2014-09-26 16:01:04 +02:00
parent 8c93be05a5
commit a67c0fb456
7 changed files with 74 additions and 38 deletions
@@ -27,9 +27,11 @@ package com.twelvemonkeys.imageio.plugins.tiff;/*
*/
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
import org.junit.Test;
import javax.imageio.spi.ImageReaderSpi;
import java.awt.*;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
@@ -60,7 +62,8 @@ public class TIFFImageReaderTest extends ImageReaderAbstractTestCase<TIFFImageRe
new TestData(getClassLoaderResource("/tiff/ycbcr-cat.tif"), new Dimension(250, 325)), // YCbCr, LZW compressed
new TestData(getClassLoaderResource("/tiff/quad-jpeg.tif"), new Dimension(512, 384)), // YCbCr, JPEG compressed, striped
new TestData(getClassLoaderResource("/tiff/smallliz.tif"), new Dimension(160, 160)), // YCbCr, Old-Style JPEG compressed (full JFIF stream)
new TestData(getClassLoaderResource("/tiff/zackthecat.tif"), new Dimension(234, 213)) // YCbCr, Old-Style JPEG compressed (tables, no JFIF stream)
new TestData(getClassLoaderResource("/tiff/zackthecat.tif"), new Dimension(234, 213)), // YCbCr, Old-Style JPEG compressed (tables, no JFIF stream)
new TestData(getClassLoaderResource("/tiff/test-single-gray-compression-type-2.tiff"), new Dimension(1728, 1146)) // Gray, CCITT type 2 compressed
);
}
@@ -94,5 +97,27 @@ public class TIFFImageReaderTest extends ImageReaderAbstractTestCase<TIFFImageRe
return Arrays.asList("image/tiff");
}
@Test
public void testReadWithSourceRegionParamEqualImageTiled() throws IOException {
assertReadWithSourceRegionParamEqualImage(
new Rectangle(23, 23, 15, 15),
new TestData(getClassLoaderResource("/tiff/sm_colors_pb_tile.tif"), new Dimension(64, 64)),
0
);
}
// TODO: Should test USHORT & INT datatypes
@Test
public void testReadWithSourceRegionParamEqualImageJPEG() throws IOException {
// The tiles are 512 x 16, make sure we read across tiles
assertReadWithSourceRegionParamEqualImage(
new Rectangle(71, 71, 17, 21),
new TestData(getClassLoaderResource("/tiff/quad-jpeg.tif"), new Dimension(512, 384)),
0
);
}
// TODO: Test YCbCr colors
}