8198334: java/awt/FileDialog/8003399/bug8003399.java fails in headless mode
Reviewed-by: pbansal, psadhukhan
This commit is contained in:
parent
9d71814dca
commit
c89ee9b0a1
test/jdk
@ -124,7 +124,6 @@ java/awt/Focus/UnaccessibleChoice/AccessibleChoiceTest.java 8239801 macosx-all
|
||||
java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java 8022302 generic-all
|
||||
java/awt/Frame/FrameLocation/FrameLocation.java 8233703 linux-all
|
||||
java/awt/FileDialog/FileDialogIconTest/FileDialogIconTest.java 8160558 windows-all
|
||||
java/awt/FileDialog/8003399/bug8003399.java 8198334 windows-all
|
||||
java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java 8060176 windows-all,macosx-all
|
||||
java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java 8060176 windows-all,macosx-all
|
||||
java/awt/dnd/DropTargetEnterExitTest/MissedDragExitTest.java 8159694 linux-all
|
||||
@ -283,7 +282,6 @@ java/awt/print/PrinterJob/Margins.java 8196301 windows-all,macosx-all
|
||||
java/awt/PrintJob/PrinterException.java 8196301 windows-all,macosx-all
|
||||
java/awt/Choice/PopupPosTest/PopupPosTest.java 8197811 windows-all
|
||||
java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 7100044 macosx-all,linux-all
|
||||
java/awt/Component/CreateImage/CreateImage.java 8198334 windows-all
|
||||
java/awt/Component/GetScreenLocTest/GetScreenLocTest.java 4753654 generic-all
|
||||
java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java 8165863 macosx-all
|
||||
java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.java 8017454 macosx-all
|
||||
@ -729,7 +727,6 @@ javax/sound/midi/Sequencer/MetaCallback.java 8178698 linux-all
|
||||
|
||||
# jdk_swing
|
||||
|
||||
com/sun/java/swing/plaf/windows/Test8173145.java 8198334 windows-all
|
||||
javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8233177 linux-all,windows-all
|
||||
|
||||
javax/swing/border/TestTitledBorderLeak.java 8213531 linux-all
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2020, 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
|
||||
@ -22,40 +22,56 @@
|
||||
*/
|
||||
|
||||
/* @test
|
||||
@key headful
|
||||
@bug 8173145
|
||||
@requires (os.family == "windows")
|
||||
@summary Menu is activated after using mnemonic Alt/Key combination
|
||||
@modules java.desktop/com.sun.java.swing.plaf.windows
|
||||
@run main Test8173145
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Component;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
public class Test8173145 {
|
||||
|
||||
private volatile static JButton btn;
|
||||
private volatile static JFrame f;
|
||||
private volatile static boolean uiCreated;
|
||||
|
||||
public static void main(String[] args) throws InvocationTargetException, InterruptedException, AWTException {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
uiCreated = createGUI();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
uiCreated = createGUI();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (uiCreated) {
|
||||
test();
|
||||
} else {
|
||||
//no windows l&f, skip the test
|
||||
if (uiCreated) {
|
||||
test();
|
||||
} else {
|
||||
//no windows l&f, skip the test
|
||||
}
|
||||
}finally {
|
||||
SwingUtilities.invokeAndWait(() -> f.dispose());
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,13 +82,14 @@ public class Test8173145 {
|
||||
} catch (AWTException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
robot.setAutoDelay(100);
|
||||
robot.setAutoDelay(150);
|
||||
robot.waitForIdle();
|
||||
|
||||
robot.keyPress(KeyEvent.VK_ALT);
|
||||
robot.keyPress(KeyEvent.VK_M);
|
||||
robot.keyRelease(KeyEvent.VK_M);
|
||||
robot.keyRelease(KeyEvent.VK_ALT);
|
||||
robot.waitForIdle();
|
||||
|
||||
Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
|
||||
@ -87,7 +104,7 @@ public class Test8173145 {
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
JFrame f = new JFrame();
|
||||
f = new JFrame();
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
btn = new JButton("Mmmmm");
|
||||
@ -103,6 +120,7 @@ public class Test8173145 {
|
||||
f.add(panel);
|
||||
f.pack();
|
||||
f.setVisible(true);
|
||||
f.setLocationRelativeTo(null);
|
||||
tf.requestFocus();
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user