Skip to content

Commit

Permalink
8328697: SubMenuShowTest and SwallowKeyEvents tests stabilization
Browse files Browse the repository at this point in the history
Backport-of: 638708c
  • Loading branch information
GoeLin committed Nov 20, 2024
1 parent b88676d commit 73d6539
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2024, 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
Expand All @@ -21,19 +21,6 @@
* questions.
*/

/*
@test
@key headful
@bug 6380743 8158380 8198624
@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 main SubMenuShowTest
*/

import java.awt.Robot;
import java.awt.BorderLayout;
import java.awt.event.KeyEvent;
Expand All @@ -48,6 +35,17 @@
import jdk.test.lib.Platform;
import test.java.awt.regtesthelpers.Util;

/*
@test
@key headful
@bug 6380743 8158380 8198624
@summary Submenu should be shown by mnemonic key press.
@library /java/awt/regtesthelpers
@library /test/lib
@build Util
@build jdk.test.lib.Platform
@run main SubMenuShowTest
*/
public class SubMenuShowTest {
private static Robot robot;
private static JFrame frame;
Expand Down Expand Up @@ -116,6 +114,8 @@ public void actionPerformed(ActionEvent e) {
}

public static void doTest() {
robot.waitForIdle();
robot.delay(1000);
boolean isMacOSX = Platform.isOSX();
if (isMacOSX) {
robot.keyPress(KeyEvent.VK_CONTROL);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2024, 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
Expand All @@ -21,20 +21,6 @@
* questions.
*/

/*
@test
@key headful
@bug 7154072 7161320
@summary Tests that key events with modifiers are not swallowed.
@author anton.tarasov: area=awt.focus
@library ../../../regtesthelpers
@library /test/lib
@modules java.desktop/sun.awt
@build jdk.test.lib.Platform
@build Util
@run main SwallowKeyEvents
*/

import jdk.test.lib.Platform;
import java.awt.AWTException;
import java.awt.Frame;
Expand All @@ -44,6 +30,20 @@
import java.awt.event.KeyEvent;
import test.java.awt.regtesthelpers.Util;

/*
@test
@key headful
@bug 7154072 7161320
@summary Tests that key events with modifiers are not swallowed.
@requires (os.family != "windows")
@library /java/awt/regtesthelpers
@library /test/lib
@modules java.desktop/sun.awt
@build jdk.test.lib.Platform
@build Util
@run main SwallowKeyEvents
*/

public class SwallowKeyEvents {
static final int PRESS_COUNT = 10;

Expand Down Expand Up @@ -83,6 +83,8 @@ public void keyPressed(KeyEvent ke) {
});

test();
r.waitForIdle();
r.delay(500);

System.out.println("key_pressed count: " + keyPressedCount);

Expand Down

0 comments on commit 73d6539

Please sign in to comment.