author | dcubed |
Wed, 20 Jun 2012 14:18:25 -0700 | |
changeset 13092 | 3b4aad065f27 |
parent 11667 | b01021d82350 |
child 26744 | fda83f5c88d1 |
permissions | -rw-r--r-- |
11667
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
1 |
/* |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
2 |
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
4 |
* |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
8 |
* |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
13 |
* accompanied this code). |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
14 |
* |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
18 |
* |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
21 |
* questions. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
22 |
*/ |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
23 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
24 |
/* |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
25 |
* @test |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
26 |
* @bug 4843282 4886871 |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
27 |
* @summary Makes sure windows is only listed on Windows platform, and |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
28 |
* GTK is not on Windows and Mac. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
29 |
* added as tabs |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
30 |
* @author Scott Violet |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
31 |
*/ |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
32 |
import javax.swing.*; |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
33 |
import javax.swing.UIManager.LookAndFeelInfo; |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
34 |
import sun.awt.OSInfo; |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
35 |
import sun.awt.OSInfo.OSType; |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
36 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
37 |
public class UITest { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
38 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
39 |
public static void main(String[] args) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
40 |
OSType os = OSInfo.getOSType(); |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
41 |
LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels(); |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
42 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
43 |
switch (os) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
44 |
case WINDOWS: |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
45 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
46 |
// Make sure we don't have GTK. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
47 |
if (hasLAF("gtk", lafInfo)) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
48 |
throw new RuntimeException("On windows, but GTK is present"); |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
49 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
50 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
51 |
// Make sure we don't have Aqua. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
52 |
if (hasLAF("mac", lafInfo)) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
53 |
throw new RuntimeException("On windows, but Aqua is present"); |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
54 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
55 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
56 |
// Make sure we have Windows. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
57 |
if (!hasLAF("windows", lafInfo)) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
58 |
throw new RuntimeException("On windows and don't have Windows"); |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
59 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
60 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
61 |
break; |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
62 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
63 |
case MACOSX: |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
64 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
65 |
// Make sure we don't have GTK. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
66 |
if (hasLAF("gtk", lafInfo)) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
67 |
throw new RuntimeException("On mac, but GTK is present"); |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
68 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
69 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
70 |
// Make sure we don't have Windows. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
71 |
if (hasLAF("windows", lafInfo)) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
72 |
throw new RuntimeException("On mac, but Windows is present"); |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
73 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
74 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
75 |
// Make sure we have Aqua. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
76 |
if (!hasLAF("mac", lafInfo)) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
77 |
throw new RuntimeException("On mac and don't have Aqua"); |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
78 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
79 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
80 |
break; |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
81 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
82 |
default: |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
83 |
// Not windows and mac |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
84 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
85 |
// Make sure we don't have Windows. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
86 |
if (hasLAF("windows", lafInfo)) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
87 |
throw new RuntimeException("Not on windows and have Windows"); |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
88 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
89 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
90 |
// Make sure we don't have Aqua. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
91 |
if (hasLAF("mac", lafInfo)) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
92 |
throw new RuntimeException("Not on mac and have Aqua"); |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
93 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
94 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
95 |
// Make sure we have GTK. |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
96 |
if (!hasLAF("gtk", lafInfo)) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
97 |
throw new RuntimeException( |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
98 |
"Not on Windows and Mac and don't have GTK!"); |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
99 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
100 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
101 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
102 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
103 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
104 |
public static boolean hasLAF(String name, LookAndFeelInfo[] lafInfo) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
105 |
|
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
106 |
for (int counter = 0; counter < lafInfo.length; counter++) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
107 |
if (lafInfo[counter].getName().toLowerCase().indexOf(name) != -1) { |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
108 |
return true; |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
109 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
110 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
111 |
return false; |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
112 |
} |
b01021d82350
7122149: [macosx] closed/javax/swing/UITest/UITest.java fails on MacOS
alexsch
parents:
diff
changeset
|
113 |
} |