< prev index next >
test/jdk/javax/swing/UITest/UITest.java
Print this page
rev 51542 : 8210039: move OSInfo to top level testlibrary
Reviewed-by: duke
@@ -26,28 +26,24 @@
* @bug 4843282 4886871
* @summary Makes sure windows is only listed on Windows platform, and
* GTK is not on Windows and Mac.
* added as tabs
* @author Scott Violet
- * @library ../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
* @run main UITest
*/
import javax.swing.*;
import javax.swing.UIManager.LookAndFeelInfo;
-import jdk.testlibrary.OSInfo;
-import jdk.testlibrary.OSInfo.OSType;
+
+import jdk.test.lib.Platform;
public class UITest {
public static void main(String[] args) {
- OSType os = OSInfo.getOSType();
LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
-
- switch (os) {
- case WINDOWS:
-
+ if (Platform.isWindows()) {
// Make sure we don't have GTK.
if (hasLAF("gtk", lafInfo)) {
throw new RuntimeException("On windows, but GTK is present");
}
@@ -58,15 +54,11 @@
// Make sure we have Windows.
if (!hasLAF("windows", lafInfo)) {
throw new RuntimeException("On windows and don't have Windows");
}
-
- break;
-
- case MACOSX:
-
+ } else if (Platform.isOSX()) {
// Make sure we don't have GTK.
if (hasLAF("gtk", lafInfo)) {
throw new RuntimeException("On mac, but GTK is present");
}
@@ -77,14 +69,11 @@
// Make sure we have Aqua.
if (!hasLAF("mac", lafInfo)) {
throw new RuntimeException("On mac and don't have Aqua");
}
-
- break;
-
- default:
+ } else {
// Not windows and mac
// Make sure we don't have Windows.
if (hasLAF("windows", lafInfo)) {
throw new RuntimeException("Not on windows and have Windows");
@@ -99,11 +88,10 @@
if (!hasLAF("gtk", lafInfo)) {
throw new RuntimeException(
"Not on Windows and Mac and don't have GTK!");
}
}
-
}
public static boolean hasLAF(String name, LookAndFeelInfo[] lafInfo) {
for (int counter = 0; counter < lafInfo.length; counter++) {
< prev index next >