On Fri, 18 Oct 2024 17:41:51 GMT, Alexey Ivanov <[email protected]> wrote:

>> I reversed the order because window may gain focus before all the events are 
>> processed.
>> 
>> To ensure all the events in the queue are handled, I added 
>> `robot.waitForIdle()`.
>> 
>> The next action in the test is to get location of the button, which can be 
>> done safely since the frame must be displaying on the screen because it has 
>> already received `windowGainedFocus` event.
>> 
>> For this reason, there's no need for `robot.delay(1000)`.
>
> This test follows the same pattern that I used in 
> https://github.com/openjdk/jdk/pull/21474:
> 
> https://github.com/openjdk/jdk/pull/21474/files#diff-2a8cee50408407d7e24de4cb85f0921cfc5db7c215d3b29cf101a4050323e9a9R92

> To ensure all the events in the queue are handled, I added 
> `robot.waitForIdle()`.

This will flush events which were posted after the windows gained focus, but 
before the patch the test flushed all events (including event to show the 
window which might be asynchronous). My point is that this operation might be 
longer that 1 second(one of the reason we have all that deleyas). So we should 
waitForIdle first, then wait via delay or other sync_ops.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21475#discussion_r1807071301

Reply via email to