Skip to content
Permalink
Browse files
8136517: [macosx]Test java/awt/Focus/8073453/AWTFocusTransitionTest.j…
…ava fails on MacOSX

Backport-of: 0438cea
  • Loading branch information
RealCLanger committed Nov 10, 2021
1 parent c406da1 commit 2876be0e7ad4968f7a184727b848605e578d5072
Showing 3 changed files with 28 additions and 14 deletions.
@@ -170,8 +170,6 @@ java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java 7019055 windows-all,l
java/awt/Focus/8013611/JDK8013611.java 8175366 windows-all,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/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/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java 8169476 windows-all,macosx-all
java/awt/event/KeyEvent/KeyChar/KeyCharTest.java 8169474,8224055 macosx-all,windows-all
@@ -26,12 +26,18 @@
* @key headful
* @bug 8073453
* @summary Focus doesn't move when pressing Shift + Tab keys
* @author Dmitry Markov
* @compile AWTFocusTransitionTest.java
* @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;

public class AWTFocusTransitionTest {
@@ -43,7 +49,7 @@ public class AWTFocusTransitionTest {

public static void main(String[] args) throws Exception {
robot = new Robot();
robot.setAutoDelay(50);
robot.setAutoDelay(100);

try {
createAndShowGUI();
@@ -101,14 +107,15 @@ private static void createAndShowGUI() {
p.add(panel);

frame.add(p);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}

private static void checkFocusOwner(Component component) {
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);
}
}
}

@@ -26,13 +26,20 @@
* @key headful
* @bug 8073453
* @summary Focus doesn't move when pressing Shift + Tab keys
* @author Dmitry Markov
* @compile SwingFocusTransitionTest.java
* @run main/othervm SwingFocusTransitionTest
*/

import javax.swing.*;
import java.awt.*;
import javax.swing.JButton;
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;

public class SwingFocusTransitionTest {
@@ -44,7 +51,7 @@ public class SwingFocusTransitionTest {

public static void main(String[] args) throws Exception {
robot = new Robot();
robot.setAutoDelay(50);
robot.setAutoDelay(100);

try {
SwingUtilities.invokeAndWait(new Runnable() {
@@ -112,19 +119,21 @@ private static void createAndShowGUI() {
p.add(panel);

frame.add(p);
frame.setLocationRelativeTo(null);
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() {
@Override
public void run() {
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);
}
}
});
}
}

1 comment on commit 2876be0

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 2876be0 Nov 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.