8198624: java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html fails on mac
Reviewed-by: serb
This commit is contained in:
parent
5a9a338c8e
commit
fe6aa29326
@ -151,7 +151,6 @@ java/awt/grab/EmbeddedFrameTest1/EmbeddedFrameTest1.java 7080150 macosx-all
|
|||||||
java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java 8168646 generic-all
|
java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java 8168646 generic-all
|
||||||
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogButtonTest/EnqueueWithDialogButtonTest.java 8198623 macosx-all
|
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogButtonTest/EnqueueWithDialogButtonTest.java 8198623 macosx-all
|
||||||
java/awt/KeyboardFocusmanager/TypeAhead/FreezeTest/FreezeTest.java 8198623 macosx-all
|
java/awt/KeyboardFocusmanager/TypeAhead/FreezeTest/FreezeTest.java 8198623 macosx-all
|
||||||
java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html 8198624 macosx-all
|
|
||||||
java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.html 8198626 macosx-all
|
java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.html 8198626 macosx-all
|
||||||
java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java 8049405 macosx-all
|
java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java 8049405 macosx-all
|
||||||
java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java 8048171 generic-all
|
java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java 8048171 generic-all
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright (c) 2006, 2018, 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
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
or visit www.oracle.com if you need additional information or have any
|
|
||||||
questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<!--
|
|
||||||
@test
|
|
||||||
@key headful
|
|
||||||
@bug 6380743
|
|
||||||
@summary Submenu should be shown by mnemonic key press.
|
|
||||||
@author anton.tarasov@...: area=awt.focus
|
|
||||||
@library ../../../regtesthelpers
|
|
||||||
@library /test/lib
|
|
||||||
@build Util
|
|
||||||
@build jdk.test.lib.Platform
|
|
||||||
@run applet SubMenuShowTest.html
|
|
||||||
-->
|
|
||||||
<head>
|
|
||||||
<title>SubMenuShowTest</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h1>SubMenuShowTest<br>Bug ID: 6380743</h1>
|
|
||||||
|
|
||||||
<p>See the dialog box (usually in upper left corner) for instructions</p>
|
|
||||||
|
|
||||||
<APPLET CODE=SubMenuShowTest.class WIDTH=200 HEIGHT=200></APPLET>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -22,50 +22,78 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
test
|
@test
|
||||||
@bug 6380743 8158380
|
@key headful
|
||||||
@summary Submenu should be shown by mnemonic key press.
|
@bug 6380743 8158380 8198624
|
||||||
@author anton.tarasov@...: area=awt.focus
|
@summary Submenu should be shown by mnemonic key press.
|
||||||
@run applet SubMenuShowTest.html
|
@author anton.tarasov@...: area=awt.focus
|
||||||
|
@library ../../../regtesthelpers
|
||||||
|
@library /test/lib
|
||||||
|
@build Util
|
||||||
|
@build jdk.test.lib.Platform
|
||||||
|
@run main SubMenuShowTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Robot;
|
||||||
import java.awt.event.*;
|
import java.awt.BorderLayout;
|
||||||
import javax.swing.*;
|
import java.awt.event.KeyEvent;
|
||||||
import java.applet.Applet;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JMenuBar;
|
||||||
|
import javax.swing.JMenu;
|
||||||
|
import javax.swing.JMenuItem;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
|
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import test.java.awt.regtesthelpers.Util;
|
import test.java.awt.regtesthelpers.Util;
|
||||||
|
|
||||||
public class SubMenuShowTest extends Applet {
|
public class SubMenuShowTest {
|
||||||
Robot robot;
|
private static Robot robot;
|
||||||
JFrame frame = new JFrame("Test Frame");
|
private static JFrame frame;
|
||||||
JMenuBar bar = new JMenuBar();
|
private static JMenuBar bar;
|
||||||
JMenu menu = new JMenu("Menu");
|
private static JMenu menu;
|
||||||
JMenu submenu = new JMenu("More");
|
private static JMenu submenu;
|
||||||
JMenuItem item = new JMenuItem("item");
|
private static JMenuItem item;
|
||||||
AtomicBoolean activated = new AtomicBoolean(false);
|
private static AtomicBoolean activated = new AtomicBoolean(false);
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws Exception {
|
||||||
SubMenuShowTest app = new SubMenuShowTest();
|
SwingUtilities.invokeAndWait(SubMenuShowTest::createAndShowGUI);
|
||||||
app.init();
|
|
||||||
app.start();
|
try {
|
||||||
|
robot = new Robot();
|
||||||
|
robot.setAutoDelay(100);
|
||||||
|
robot.setAutoWaitForIdle(true);
|
||||||
|
|
||||||
|
doTest();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new RuntimeException("Test failed: Exception thrown:"+ex);
|
||||||
|
} finally {
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Test passed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public static void dispose() throws Exception {
|
||||||
robot = Util.createRobot();
|
if(frame != null) {
|
||||||
robot.setAutoDelay(200);
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
robot.setAutoWaitForIdle(true);
|
frame.dispose();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void createAndShowGUI() {
|
||||||
// Create instructions for the user here, as well as set up
|
// Create instructions for the user here, as well as set up
|
||||||
// the environment -- set the layout manager, add buttons,
|
// the environment -- set the layout manager, add buttons,
|
||||||
// etc.
|
// etc.
|
||||||
this.setLayout (new BorderLayout ());
|
frame = new JFrame("Test Frame");
|
||||||
}
|
bar = new JMenuBar();
|
||||||
|
menu = new JMenu("Menu");
|
||||||
|
submenu = new JMenu("More");
|
||||||
|
item = new JMenuItem("item");
|
||||||
|
|
||||||
public void start() {
|
frame.setLayout (new BorderLayout ());
|
||||||
menu.setMnemonic('f');
|
menu.setMnemonic('f');
|
||||||
submenu.setMnemonic('m');
|
submenu.setMnemonic('m');
|
||||||
menu.add(submenu);
|
menu.add(submenu);
|
||||||
@ -85,7 +113,9 @@ public class SubMenuShowTest extends Applet {
|
|||||||
});
|
});
|
||||||
|
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void doTest() {
|
||||||
boolean isMacOSX = Platform.isOSX();
|
boolean isMacOSX = Platform.isOSX();
|
||||||
if (isMacOSX) {
|
if (isMacOSX) {
|
||||||
robot.keyPress(KeyEvent.VK_CONTROL);
|
robot.keyPress(KeyEvent.VK_CONTROL);
|
||||||
@ -104,11 +134,9 @@ public class SubMenuShowTest extends Applet {
|
|||||||
robot.keyPress(KeyEvent.VK_SPACE);
|
robot.keyPress(KeyEvent.VK_SPACE);
|
||||||
robot.keyRelease(KeyEvent.VK_SPACE);
|
robot.keyRelease(KeyEvent.VK_SPACE);
|
||||||
|
|
||||||
if (!Util.waitForCondition(activated, 2000)) {
|
if (!Util.waitForCondition(activated, 1500)) {
|
||||||
throw new TestFailedException("a submenu wasn't activated by mnemonic key press");
|
throw new TestFailedException("A submenu wasn't activated by mnemonic key press");
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Test passed.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,4 +145,3 @@ class TestFailedException extends RuntimeException {
|
|||||||
super("Test failed: " + msg);
|
super("Test failed: " + msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user