< 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,53 ****
* @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
* @run main UITest
*/
import javax.swing.*;
import javax.swing.UIManager.LookAndFeelInfo;
! import jdk.testlibrary.OSInfo;
! import jdk.testlibrary.OSInfo.OSType;
public class UITest {
public static void main(String[] args) {
- OSType os = OSInfo.getOSType();
LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
!
! switch (os) {
! case WINDOWS:
!
// Make sure we don't have GTK.
if (hasLAF("gtk", lafInfo)) {
throw new RuntimeException("On windows, but GTK is present");
}
--- 26,49 ----
* @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 /test/lib
! * @build jdk.test.lib.Platform
* @run main UITest
*/
import javax.swing.*;
import javax.swing.UIManager.LookAndFeelInfo;
!
! import jdk.test.lib.Platform;
public class UITest {
public static void main(String[] args) {
LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
! if (Platform.isWindows()) {
// Make sure we don't have GTK.
if (hasLAF("gtk", lafInfo)) {
throw new RuntimeException("On windows, but GTK is present");
}
*** 58,72 ****
// Make sure we have Windows.
if (!hasLAF("windows", lafInfo)) {
throw new RuntimeException("On windows and don't have Windows");
}
!
! break;
!
! case MACOSX:
!
// Make sure we don't have GTK.
if (hasLAF("gtk", lafInfo)) {
throw new RuntimeException("On mac, but GTK is present");
}
--- 54,64 ----
// Make sure we have Windows.
if (!hasLAF("windows", lafInfo)) {
throw new RuntimeException("On windows and don't have Windows");
}
! } 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,90 ****
// Make sure we have Aqua.
if (!hasLAF("mac", lafInfo)) {
throw new RuntimeException("On mac and don't have Aqua");
}
!
! break;
!
! default:
// Not windows and mac
// Make sure we don't have Windows.
if (hasLAF("windows", lafInfo)) {
throw new RuntimeException("Not on windows and have Windows");
--- 69,79 ----
// Make sure we have Aqua.
if (!hasLAF("mac", lafInfo)) {
throw new RuntimeException("On mac and don't have Aqua");
}
! } 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,109 ****
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++) {
--- 88,97 ----
< prev index next >