< prev index next >
test/com/apple/eawt/DefaultMenuBar/DefaultMenuBarTest.java
Print this page
@@ -23,29 +23,29 @@
/*
* @test
* @bug 8007267
* @summary [macosx] com.apple.eawt.Application.setDefaultMenuBar is not working
+ * @requires (os.family == "mac")
* @author leonid.romanov@oracle.com
* @modules java.desktop/sun.awt
* java.desktop/com.apple.eawt
* @run main DefaultMenuBarTest
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import sun.awt.*;
import java.lang.reflect.Method;
public class DefaultMenuBarTest {
static KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.META_MASK);
static volatile int listenerCallCounter = 0;
public static void main(String[] args) throws Exception {
- if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) {
+ if (!System.getProperty("os.name").contains("OS X")) {
System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
return;
}
System.setProperty("apple.laf.useScreenMenuBar", "true");
@@ -53,20 +53,19 @@
public void run() {
createAndShowGUI();
}
});
- SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
Robot robot = new Robot();
robot.setAutoDelay(100);
robot.keyPress(KeyEvent.VK_META);
robot.keyPress(ks.getKeyCode());
robot.keyRelease(ks.getKeyCode());
robot.keyRelease(KeyEvent.VK_META);
- toolkit.realSync();
+ robot.waitForIdle();
if (listenerCallCounter != 1) {
throw new Exception("Test failed: ActionListener either wasn't called or was called more than once");
}
}
< prev index next >