RFR: 8341000: Open source some of the AWT Window tests [v4]

Prasanta Sadhukhan psadhukhan at openjdk.org
Thu Oct 3 12:55:36 UTC 2024


On Thu, 3 Oct 2024 12:48:30 GMT, Jayathirth D V <jdv at openjdk.org> wrote:

>> test/jdk/java/awt/Window/InvalidFocusLostEventTest/InvalidFocusLostEventTest.java line 98:
>> 
>>> 96:         // we should check focus after all events are processed,
>>> 97:         // since focus transfers are asynchronous
>>> 98:         EventQueue.invokeLater(() -> countDownLatch.countDown());
>> 
>> I guess we can just do countDown without it being in invokeLater...
>
> I have included countDown specifically inside asynchronous call of EDT because of the comment mentioned above `we should check focus after all events are processed, since focus transfers are asynchronous`.
> 
> So that we actually check for focus after everything is processed in EDT.

But I am not sure this is the correct way to ensure...We are trying to do away with invokeLater call from jtreg tests.
I think it's more apt to call robot.waitForIdle to ensure all events are processed
void
[waitForIdle](https://docs.oracle.com/en/java/javase/22/docs/api/java.desktop/java/awt/Robot.html#waitForIdle())()
Waits until all events currently on the event queue have been processed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21281#discussion_r1786173362


More information about the client-libs-dev mailing list