Add a unit test

This commit is contained in:
Bertil Chapuis 2023-12-22 11:55:10 +01:00 committed by Harald Kuhr
parent 6501321fac
commit adda52053b

View File

@ -57,6 +57,7 @@ import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@ -1014,4 +1015,15 @@ public class TIFFImageReaderTest extends ImageReaderAbstractTest<TIFFImageReader
}
}
}
@Test
public void testReadRasterColorNormalization() throws IOException {
ImageReader reader = createReader();
try (ImageInputStream stream = ImageIO.createImageInputStream(getClassLoaderResource("/tiff/ycbcr-cat.tif"))) {
reader.setInput(stream);
Raster rawRaster = reader.readRaster(0, null);
Raster normalizedRaster = reader.read(0, null).getRaster();
assertNotEquals(rawRaster.getSample(10, 10, 0), normalizedRaster.getSample(10, 10, 0), 0.0001f);
}
}
}