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

Jayathirth D V jdv at openjdk.org
Fri Oct 4 05:34:36 UTC 2024


On Thu, 3 Oct 2024 12:52:52 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> 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.

Adding waitForIdle() in EDT(actionPerformed()) is throwing IllegalThreadStateException().

So i refactored code to remove the usage of countDownLatch itself and using waitForIdle() in main(). This will serve our purpose to wait until all events are processed and then we can check for current focused UI component.

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

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


More information about the client-libs-dev mailing list