author | serb |
Tue, 15 Oct 2019 22:42:23 -0700 | |
changeset 59167 | 2cf90f3e8195 |
parent 47216 | test/jdk/java/awt/Color/GetMinMaxValue_ICC_ColorSpace.java@71c04702a3d5 |
permissions | -rw-r--r-- |
29252
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
1 |
/* |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
4 |
* |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
8 |
* |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
13 |
* accompanied this code). |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
14 |
* |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
18 |
* |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
21 |
* questions. |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
22 |
*/ |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
23 |
import java.awt.color.ColorSpace; |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
24 |
import java.awt.color.ICC_ColorSpace; |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
25 |
import java.awt.color.ICC_Profile; |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
26 |
import java.io.IOException; |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
27 |
|
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
28 |
/** |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
29 |
* @test |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
30 |
* @bug 8072678 |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
31 |
* @author Prasanta Sadhukhan |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
32 |
*/ |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
33 |
|
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
34 |
public class GetMinMaxValue_ICC_ColorSpace { |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
35 |
|
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
36 |
public static void main(String[] a) throws Exception { |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
37 |
ICC_Profile cmyk_profile = ICC_Profile.getInstance(ColorSpace.CS_sRGB); |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
38 |
ICC_ColorSpace colorSpace = new ICC_ColorSpace(cmyk_profile); |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
39 |
String minstr = null; |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
40 |
String maxstr = null; |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
41 |
|
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
42 |
colorSpace.fromRGB(new float[]{4.3f,3.1f,2.2f}); |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
43 |
try { |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
44 |
System.out.println("minvalue " + colorSpace.getMinValue(3)); |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
45 |
} catch (IllegalArgumentException iae) { |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
46 |
minstr = iae.toString(); |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
47 |
} |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
48 |
try { |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
49 |
System.out.println("maxvalue " + colorSpace.getMaxValue(3)); |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
50 |
} catch (IllegalArgumentException iae) { |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
51 |
maxstr = iae.toString(); |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
52 |
} |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
53 |
|
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
54 |
if (minstr.endsWith("+ component") || maxstr.endsWith("+ component")) { |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
55 |
System.out.println("Test failed"); |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
56 |
throw new RuntimeException("IllegalArgumentException contains incorrect text message"); |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
57 |
} else { |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
58 |
System.out.println("Test passed"); |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
59 |
} |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
60 |
} |
d4f5e0996bf2
8072678: Wrong exception messages in java.awt.color.ICC_ColorSpace
serb
parents:
diff
changeset
|
61 |
} |