8167284: [TESTBUG] [PIT] possible regression: javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java

Reviewed-by: ssadetsky, yan
This commit is contained in:
Maksim Khramov 2016-11-28 14:36:46 +03:00 committed by Yuri Nesterenko
parent 893ec91655
commit 547092cf8d

View File

@ -42,7 +42,6 @@ import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
@ -133,21 +132,7 @@ public class FocusTraversal {
}
private static void runTestCase() throws Exception {
LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
focusOn(a);
if (isExcludedLookAndFeel(lookAndFeel)) {
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
robot.waitForIdle();
isFocusOwner(b, "forward");
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.waitForIdle();
isFocusOwner(a, "backward");
} else {
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
@ -158,18 +143,10 @@ public class FocusTraversal {
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.waitForIdle();
isFocusOwner(d, "backward");
}
isFocusOwner(a, "backward");
}
private static boolean isExcludedLookAndFeel(LookAndFeel lookAndFeel) {
return lookAndFeel.toString().toLowerCase().contains("aqua")
|| lookAndFeel.toString().toLowerCase().contains("nimbus")
|| lookAndFeel.toString().toLowerCase().contains("gtk");
}
private static void focusOn(Component component)
throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {