8136517: [macosx]Test java/awt/Focus/8073453/AWTFocusTransitionTest.java fails on MacOSX

Reviewed-by: serb
This commit is contained in:
Pankaj Bansal 2021-04-28 04:48:07 +00:00
parent 6b5e5d7a2c
commit 0438cea65b
3 changed files with 28 additions and 14 deletions

View File

@ -197,8 +197,6 @@ java/awt/Focus/8013611/JDK8013611.java 8175366 windows-all,macosx-all
java/awt/Focus/6378278/InputVerifierTest.java 8198616 macosx-all java/awt/Focus/6378278/InputVerifierTest.java 8198616 macosx-all
java/awt/Focus/6382144/EndlessLoopTest.java 8198617 macosx-all java/awt/Focus/6382144/EndlessLoopTest.java 8198617 macosx-all
java/awt/Focus/6981400/Test1.java 8029675 windows-all,macosx-all java/awt/Focus/6981400/Test1.java 8029675 windows-all,macosx-all
java/awt/Focus/8073453/AWTFocusTransitionTest.java 8136517 macosx-all
java/awt/Focus/8073453/SwingFocusTransitionTest.java 8136517 macosx-all
java/awt/Focus/6981400/Test3.java 8173264 generic-all java/awt/Focus/6981400/Test3.java 8173264 generic-all
java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java 8169476 windows-all,macosx-all java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java 8169476 windows-all,macosx-all
java/awt/event/KeyEvent/KeyChar/KeyCharTest.java 8169474,8224055 macosx-all,windows-all java/awt/event/KeyEvent/KeyChar/KeyCharTest.java 8169474,8224055 macosx-all,windows-all

View File

@ -26,12 +26,18 @@
* @key headful * @key headful
* @bug 8073453 * @bug 8073453
* @summary Focus doesn't move when pressing Shift + Tab keys * @summary Focus doesn't move when pressing Shift + Tab keys
* @author Dmitry Markov
* @compile AWTFocusTransitionTest.java * @compile AWTFocusTransitionTest.java
* @run main/othervm AWTFocusTransitionTest * @run main/othervm AWTFocusTransitionTest
*/ */
import java.awt.*; import java.awt.Button;
import java.awt.Component;
import java.awt.DefaultFocusTraversalPolicy;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.Robot;
import java.awt.TextField;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
public class AWTFocusTransitionTest { public class AWTFocusTransitionTest {
@ -43,7 +49,7 @@ public class AWTFocusTransitionTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
robot = new Robot(); robot = new Robot();
robot.setAutoDelay(50); robot.setAutoDelay(100);
try { try {
createAndShowGUI(); createAndShowGUI();
@ -101,14 +107,15 @@ public class AWTFocusTransitionTest {
p.add(panel); p.add(panel);
frame.add(p); frame.add(p);
frame.setLocationRelativeTo(null);
frame.setVisible(true); frame.setVisible(true);
} }
private static void checkFocusOwner(Component component) { private static void checkFocusOwner(Component component) {
if (component != frame.getFocusOwner()) { if (component != frame.getFocusOwner()) {
throw new RuntimeException("Test Failed! Incorrect focus owner: " + frame.getFocusOwner() + throw new RuntimeException("Test Failed! Incorrect focus " +
"owner: " + frame.getFocusOwner() +
", but expected: " + component); ", but expected: " + component);
} }
} }
} }

View File

@ -26,13 +26,20 @@
* @key headful * @key headful
* @bug 8073453 * @bug 8073453
* @summary Focus doesn't move when pressing Shift + Tab keys * @summary Focus doesn't move when pressing Shift + Tab keys
* @author Dmitry Markov
* @compile SwingFocusTransitionTest.java * @compile SwingFocusTransitionTest.java
* @run main/othervm SwingFocusTransitionTest * @run main/othervm SwingFocusTransitionTest
*/ */
import javax.swing.*; import javax.swing.JButton;
import java.awt.*; import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutFocusTraversalPolicy;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.DefaultFocusTraversalPolicy;
import java.awt.GridLayout;
import java.awt.Robot;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
public class SwingFocusTransitionTest { public class SwingFocusTransitionTest {
@ -44,7 +51,7 @@ public class SwingFocusTransitionTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
robot = new Robot(); robot = new Robot();
robot.setAutoDelay(50); robot.setAutoDelay(100);
try { try {
SwingUtilities.invokeAndWait(new Runnable() { SwingUtilities.invokeAndWait(new Runnable() {
@ -112,19 +119,21 @@ public class SwingFocusTransitionTest {
p.add(panel); p.add(panel);
frame.add(p); frame.add(p);
frame.setLocationRelativeTo(null);
frame.setVisible(true); frame.setVisible(true);
} }
private static void checkFocusOwner(final Component component) throws Exception { private static void checkFocusOwner(final Component component)
throws Exception {
SwingUtilities.invokeAndWait(new Runnable() { SwingUtilities.invokeAndWait(new Runnable() {
@Override @Override
public void run() { public void run() {
if (component != frame.getFocusOwner()) { if (component != frame.getFocusOwner()) {
throw new RuntimeException("Test Failed! Incorrect focus owner: " + frame.getFocusOwner() + throw new RuntimeException("Test Failed! Incorrect focus" +
" owner: " + frame.getFocusOwner() +
", but expected: " + component); ", but expected: " + component);
} }
} }
}); });
} }
} }