8158380: [macosx] Regression: java/awt/List/ActionEventTest/ActionEventTest.java

Reviewed-by: serb, aghaisas
This commit is contained in:
Manajit Halder 2016-10-14 10:39:42 +05:30 committed by Manajit Halder
parent b521b5b0d8
commit 3230ba35f1
2 changed files with 9 additions and 19 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/*
test
@bug 6380743
@bug 6380743 8158380
@summary Submenu should be shown by mnemonic key press.
@author anton.tarasov@...: area=awt.focus
@run applet SubMenuShowTest.html
@ -55,6 +55,8 @@ public class SubMenuShowTest extends Applet {
public void init() {
robot = Util.createRobot();
robot.setAutoDelay(200);
robot.setAutoWaitForIdle(true);
// Create instructions for the user here, as well as set up
// the environment -- set the layout manager, add buttons,
@ -85,35 +87,24 @@ public class SubMenuShowTest extends Applet {
});
frame.setVisible(true);
Util.waitForIdle(robot);
boolean isMacOSX = (OSInfo.getOSType() == OSInfo.OSType.MACOSX);
if (isMacOSX) {
robot.keyPress(KeyEvent.VK_CONTROL);
robot.delay(20);
}
robot.keyPress(KeyEvent.VK_ALT);
robot.delay(20);
robot.keyPress(KeyEvent.VK_F);
robot.delay(20);
robot.keyRelease(KeyEvent.VK_F);
robot.delay(20);
robot.keyRelease(KeyEvent.VK_ALT);
if (isMacOSX) {
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.delay(20);
}
Util.waitForIdle(robot);
robot.keyPress(KeyEvent.VK_M);
robot.delay(20);
robot.keyRelease(KeyEvent.VK_M);
Util.waitForIdle(robot);
robot.keyPress(KeyEvent.VK_SPACE);
robot.delay(20);
robot.keyRelease(KeyEvent.VK_SPACE);
Util.waitForIdle(robot);
if (!Util.waitForCondition(activated, 2000)) {
throw new TestFailedException("a submenu wasn't activated by mnemonic key press");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,7 @@
/*
* @test
* @key headful
* @bug 6191390
* @bug 6191390 8158380
* @summary Verify that ActionEvent is received with correct modifiers set.
* @run main ActionEventTest
*/
@ -45,6 +45,8 @@ public class ActionEventTest extends Frame {
public ActionEventTest() {
try {
robot = new Robot();
robot.setAutoDelay(100);
robot.setAutoWaitForIdle(true);
} catch(AWTException e) {
throw new RuntimeException(e.getMessage());
}
@ -56,7 +58,6 @@ public class ActionEventTest extends Frame {
setLayout(new FlowLayout());
pack();
setVisible(true);
robot.waitForIdle();
}
void performTest() {
@ -86,11 +87,9 @@ public class ActionEventTest extends Frame {
// Press Enter on list item, to generate action event.
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
robot.waitForIdle();
robot.keyRelease(KeyEvent.VK_ALT);
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.waitForIdle();
}
public static void main(String args[]) {