RFR: 8341000: Open source some of the AWT Window tests

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue Oct 1 10:07:37 UTC 2024


On Tue, 1 Oct 2024 09:12:15 GMT, Jayathirth D V <jdv at openjdk.org> wrote:

> Clean up and open source some of the AWT window tests.
> Automated test `InvalidFocusLostEventTest.java` is verified in our CI also and it passes on all platforms.

test/jdk/java/awt/Window/BadConfigure/BadConfigure.java line 68:

> 66:         ch.add("One");
> 67:         f.setSize(200, 200);
> 68:         f.setVisible(true);

usually PassFailJFrame takes care of making frame visible..guess there will be a flashing if done twice, in some platform..

test/jdk/java/awt/Window/InvalidFocusLostEventTest/InvalidFocusLostEventTest.java line 24:

> 22:  */
> 23: 
> 24: /* @test

normally we put @test under /*

test/jdk/java/awt/Window/InvalidFocusLostEventTest/InvalidFocusLostEventTest.java line 47:

> 45:     private KeyboardFocusManager fm;
> 46: 
> 47:     static boolean failed = false;

implicit false assignment not needed...

test/jdk/java/awt/Window/InvalidFocusLostEventTest/InvalidFocusLostEventTest.java line 82:

> 80:         robot.mouseMove(bp.x + b.getWidth() / 2, bp.y + b.getHeight() / 2 );
> 81:         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK );
> 82:         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK );

spacing..

test/jdk/java/awt/Window/InvalidFocusLostEventTest/InvalidFocusLostEventTest.java line 93:

> 91:         // since focus transfers are asynchronous
> 92:         EventQueue.invokeLater(() -> {
> 93:             if (fm.getFocusOwner() != b) {

Not sure putting invokeLater is ok in the test as it can be executed after test finish..
Probably we should add a CountDownLatch and countDown here and await in main where we can check for fm.getFocusOwner()

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21281#discussion_r1782480696
PR Review Comment: https://git.openjdk.org/jdk/pull/21281#discussion_r1782481780
PR Review Comment: https://git.openjdk.org/jdk/pull/21281#discussion_r1782482845
PR Review Comment: https://git.openjdk.org/jdk/pull/21281#discussion_r1782483961
PR Review Comment: https://git.openjdk.org/jdk/pull/21281#discussion_r1782496718


More information about the client-libs-dev mailing list