Skip to content

Commit

Permalink
8326661: sun/java2d/cmm/ColorConvertOp/ColConvTest.java assumes profi…
Browse files Browse the repository at this point in the history
…les were generated by LCMS
  • Loading branch information
dmarkov20 committed Mar 3, 2024
1 parent 37e01ef commit 27d436f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 39 deletions.
10 changes: 5 additions & 5 deletions test/jdk/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,7 +23,7 @@

/**
* @test
* @bug 6476665 7033534 6830714 8052162 8196572
* @bug 6476665 7033534 6830714 8052162 8196572 8326661
* @summary Verifies color conversion of Component Color Model based images
* @run main ColConvCCMTest
*/
Expand Down Expand Up @@ -57,10 +57,10 @@ public class ColConvCCMTest extends ColConvTest {
final static double [] ACCURACY = {
// Accuracy for color conversions
2.5, // sRGB
(isOpenProfile() ? 45.0 : 10.1), // LINEAR_RGB
45.0, // LINEAR_RGB
10.5, // GRAY
(isOpenProfile() ? 215.0 : 45.5), // PYCC
(isOpenProfile() ? 56.0 : 47.5) // CIEXYZ
215.0, // PYCC
56.0 // CIEXYZ
};

final static String [] gldImgNames = {
Expand Down
6 changes: 3 additions & 3 deletions test/jdk/sun/java2d/cmm/ColorConvertOp/ColConvDCMTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,7 +23,7 @@

/**
* @test
* @bug 6476665
* @bug 6476665 8326661
* @summary Verifies color conversion of Direct Color Model based images
* @run main ColConvDCMTest
*/
Expand Down Expand Up @@ -65,7 +65,7 @@ public class ColConvDCMTest extends ColConvTest {
final static double [] ACCURACY = {
// Accuracy for color conversions
2.5, // sRGB
(isOpenProfile() ? 45.0 : 2.5), // LINEAR_RGB
45.0 // LINEAR_RGB
};

final static String [] gldImgNames = {
Expand Down
32 changes: 1 addition & 31 deletions test/jdk/sun/java2d/cmm/ColorConvertOp/ColConvTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -22,7 +22,6 @@
*/

import java.awt.color.ColorSpace;
import java.awt.color.ICC_Profile;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;

Expand Down Expand Up @@ -127,33 +126,4 @@ public final void run() {
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;
}
}

0 comments on commit 27d436f

Please sign in to comment.