提交 4af3f8a7 编写于 作者: A aivanov

8087110: [TESTBUG] Test javax/swing/JFileChooser/8002077/bug8002077.java fails

Reviewed-by: serb, alexsch
上级 09604c93
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -47,6 +47,8 @@ public class bug8002077 { ...@@ -47,6 +47,8 @@ public class bug8002077 {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) { if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName()); UIManager.setLookAndFeel(info.getClassName());
UIManager.put("FileChooser.openButtonMnemonic", KeyEvent.VK_O);
UIManager.put("FileChooser.saveButtonMnemonic", KeyEvent.VK_S);
runTest(); runTest();
break; break;
} }
...@@ -58,24 +60,24 @@ public class bug8002077 { ...@@ -58,24 +60,24 @@ public class bug8002077 {
Robot robot = new Robot(); Robot robot = new Robot();
robot.setAutoDelay(50); robot.setAutoDelay(50);
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(() ->
public void run() { fileChooserState = new JFileChooser().showSaveDialog(null));
fileChooserState = new JFileChooser().showSaveDialog(null);
}
});
toolkit.realSync(); toolkit.realSync();
Util.hitMnemonics(robot, KeyEvent.VK_N); Util.hitMnemonics(robot, KeyEvent.VK_N);
toolkit.realSync(); toolkit.realSync();
robot.keyPress(KeyEvent.VK_A); Util.hitKeys(robot, KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
toolkit.realSync(); toolkit.realSync();
Util.hitMnemonics(robot, KeyEvent.VK_S); Util.hitMnemonics(robot, KeyEvent.VK_S);
toolkit.realSync(); toolkit.realSync();
if (fileChooserState != JFileChooser.APPROVE_OPTION) { if (fileChooserState != JFileChooser.APPROVE_OPTION) {
// Close the dialog
Util.hitKeys(robot, KeyEvent.VK_ESCAPE);
toolkit.realSync();
throw new RuntimeException("Save button is not pressed!"); throw new RuntimeException("Save button is not pressed!");
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册