TMI-41: Fix for CorbisRGB special handling testcase JDK 1.7+

This commit is contained in:
Harald Kuhr
2015-01-06 12:45:54 +01:00
parent 662f12a41d
commit f588d65565
3 changed files with 13 additions and 5 deletions
@@ -34,6 +34,7 @@ import java.awt.color.ColorSpace;
import java.awt.color.ICC_ColorSpace;
import java.awt.color.ICC_Profile;
import java.io.IOException;
import java.util.Arrays;
import static org.junit.Assert.*;
@@ -45,6 +46,9 @@ import static org.junit.Assert.*;
* @version $Id: ColorSpacesTest.java,v 1.0 07.02.11 14.32 haraldk Exp$
*/
public class ColorSpacesTest {
private static final byte[] XYZ = new byte[] {'X', 'Y', 'Z', ' '};
@Test
public void testCreateColorSpaceFromKnownProfileReturnsInternalCS_sRGB() {
ICC_Profile profile = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
@@ -189,11 +193,15 @@ public class ColorSpacesTest {
@Test
public void testCorbisRGBSpecialHandling() throws IOException {
ICC_Profile corbisRGB = ICC_Profile.getInstance(getClass().getResourceAsStream("/profiles/Corbis RGB.icc"));
ICC_Profile corbisRGBFixed = ICC_Profile.getInstance(getClass().getResourceAsStream("/profiles/Corbis RGB_fixed.icc"));
ICC_ColorSpace colorSpace = ColorSpaces.createColorSpace(corbisRGB);
assertNotNull(colorSpace);
assertArrayEquals(colorSpace.getProfile().getData(), corbisRGBFixed.getData());
// Make sure all known affected tags have type 'XYZ '
ICC_Profile profile = colorSpace.getProfile();
assertArrayEquals(XYZ, Arrays.copyOfRange(profile.getData(ICC_Profile.icSigMediaWhitePointTag), 0, 4));
assertArrayEquals(XYZ, Arrays.copyOfRange(profile.getData(ICC_Profile.icSigRedColorantTag), 0, 4));
assertArrayEquals(XYZ, Arrays.copyOfRange(profile.getData(ICC_Profile.icSigGreenColorantTag), 0, 4));
assertArrayEquals(XYZ, Arrays.copyOfRange(profile.getData(ICC_Profile.icSigBlueColorantTag), 0, 4));
}
}