changeset 7323:917dd642f934

6830714: cmm test failures with OpenJDK Reviewed-by: prr
author bae
date Fri, 07 Jun 2013 14:45:29 +0400
parents 616a73e97b38
children 1431488fb0f9
files test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java test/sun/java2d/cmm/ColorConvertOp/ColConvDCMTest.java test/sun/java2d/cmm/ColorConvertOp/ColConvTest.java
diffstat 3 files changed, 41 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java	Thu Jun 06 13:57:25 2013 +0400
+++ b/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java	Fri Jun 07 14:45:29 2013 +0400
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6476665 7033534
+ * @bug 6476665 7033534 6830714
  * @summary Verifies color conversion of Component Color Model based images
  * @run main ColConvCCMTest
  */
@@ -57,9 +57,9 @@
     final static double [] ACCURACY = {
     // Accuracy for color conversions
         2.5,        // sRGB
-        6.5,        // LINEAR_RGB
+        (isOpenProfile() ? 45.0 : 10.1), // LINEAR_RGB
         10.5,       // GRAY
-        45.5,       // PYCC
+        (isOpenProfile() ? 207 : 45.5), // PYCC
         47.5        // CIEXYZ
     };
 
--- a/test/sun/java2d/cmm/ColorConvertOp/ColConvDCMTest.java	Thu Jun 06 13:57:25 2013 +0400
+++ b/test/sun/java2d/cmm/ColorConvertOp/ColConvDCMTest.java	Fri Jun 07 14:45:29 2013 +0400
@@ -62,7 +62,11 @@
         ColorSpace.CS_LINEAR_RGB,
     };
 
-    final static double ACCURACY = 2.5;
+    final static double [] ACCURACY = {
+        // Accuracy for color conversions
+        2.5, // sRGB
+        (isOpenProfile() ? 45.0 : 2.5), // LINEAR_RGB
+    };
 
     final static String [] gldImgNames = {
         "SRGB.png", "SRGB555.png", "SRGB565.png", "LRGB.png", "LRGB555.png",
@@ -142,7 +146,7 @@
 
             if (!testImage(imgTypes[i][0], imgTypes[i][1], imgTypes[i][2],
                            imgTypes[i][3], cSpaces[imgTypes[i][4]], gldImage,
-                           ACCURACY))
+                           ACCURACY[imgTypes[i][4]]))
             {
                 throw new RuntimeException(
                     "Invalid result of the ColorConvertOp for " +
@@ -154,7 +158,8 @@
 
             if (!testSubImage(SI_X, SI_Y, SI_W, SI_H, imgTypes[i][0],
                               imgTypes[i][1], imgTypes[i][2], imgTypes[i][3],
-                              cSpaces[imgTypes[i][4]], gldImage, ACCURACY))
+                              cSpaces[imgTypes[i][4]], gldImage,
+                              ACCURACY[imgTypes[i][4]]))
             {
                 throw new RuntimeException(
                     "Invalid result of the ColorConvertOp for " +
--- a/test/sun/java2d/cmm/ColorConvertOp/ColConvTest.java	Thu Jun 06 13:57:25 2013 +0400
+++ b/test/sun/java2d/cmm/ColorConvertOp/ColConvTest.java	Fri Jun 07 14:45:29 2013 +0400
@@ -22,6 +22,7 @@
  */
 
 import java.awt.color.ColorSpace;
+import java.awt.color.ICC_Profile;
 import java.awt.image.BufferedImage;
 import java.awt.image.DataBuffer;
 
@@ -126,4 +127,33 @@
     public boolean isPassed() {
         return passed;
     }
+
+    private static Boolean isOpenProfile = null;
+
+    public static boolean isOpenProfile() {
+        if (isOpenProfile == null) {
+            ICC_Profile p = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
+
+            byte[] h = p.getData(ICC_Profile.icSigHead);
+
+            if (h == null || h.length < 128) {
+                throw new RuntimeException("Test failed: invalid sRGB header");
+            }
+
+            final byte[] lcmsID = new byte[] {
+                (byte)0x6c, // l
+                (byte)0x63, // c
+                (byte)0x6d, // m
+                (byte)0x73, // s
+            };
+
+            int off = ICC_Profile.icHdrCmmId;
+
+            isOpenProfile = ((h[off + 0] == lcmsID[0])
+                    && (h[off + 1] == lcmsID[1])
+                    && (h[off + 2] == lcmsID[2])
+                    && (h[off + 3] == lcmsID[3]));
+        }
+        return isOpenProfile;
+    }
 }