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

Reviewed-by: serb
  • Loading branch information
Pankaj Bansal committed Apr 28, 2021
1 parent 6b5e5d7 commit 0438cea65b927bcf3d039b290de7fd7c60a06922
Showing with 28 additions and 14 deletions.
  1. +0 −2 test/jdk/ProblemList.txt
  2. +12 −5 test/jdk/java/awt/Focus/8073453/AWTFocusTransitionTest.java
  3. +16 −7 test/jdk/java/awt/Focus/8073453/SwingFocusTransitionTest.java
@@ -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/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);
}
}
});
}
}

3 comments on commit 0438cea

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 0438cea Apr 28, 2021

Choose a reason for hiding this comment

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

@RealCLanger
Copy link
Contributor

@RealCLanger RealCLanger commented on 0438cea Nov 4, 2021

Choose a reason for hiding this comment

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

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 0438cea Nov 4, 2021

Choose a reason for hiding this comment

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

@RealCLanger @RealCLanger the backport was successfully created on the branch RealCLanger-backport-0438cea6 in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit 0438cea6 from the openjdk/jdk repository.

The commit being backported was authored by Pankaj Bansal on 28 Apr 2021 and was reviewed by Sergey Bylokhov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev RealCLanger-backport-0438cea6:RealCLanger-backport-0438cea6
$ git checkout RealCLanger-backport-0438cea6
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev RealCLanger-backport-0438cea6

Please sign in to comment.