8328697: SubMenuShowTest and SwallowKeyEvents tests stabilization

Reviewed-by: kizune
This commit is contained in:
Alexander Zvegintsev 2024-03-22 13:13:13 +00:00
parent e06b568c3c
commit 638708cad8
2 changed files with 31 additions and 29 deletions

View File

@ -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
@ -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;
@ -48,6 +35,17 @@ import java.util.concurrent.atomic.AtomicBoolean;
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;
@ -116,6 +114,8 @@ public class SubMenuShowTest {
}
public static void doTest() {
robot.waitForIdle();
robot.delay(1000);
boolean isMacOSX = Platform.isOSX();
if (isMacOSX) {
robot.keyPress(KeyEvent.VK_CONTROL);

View File

@ -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
@ -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;
@ -44,6 +30,20 @@ import java.awt.event.KeyAdapter;
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;
@ -83,6 +83,8 @@ public class SwallowKeyEvents {
});
test();
r.waitForIdle();
r.delay(500);
System.out.println("key_pressed count: " + keyPressedCount);