RFR: 8341982: Simplify JButton/bug4323121.java [v4]
Alexey Ivanov
aivanov at openjdk.org
Fri Oct 18 17:44:41 UTC 2024
On Fri, 18 Oct 2024 16:48:21 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> test/jdk/javax/swing/JButton/bug4323121.java line 66:
>>
>>> 64: });
>>> 65: robot.waitForIdle();
>>> 66: robot.delay(1000);
>>
>> The new code probably should follow the same pattern, flush all events/commands to native by the waitForIdle. and then wait response from OS for 1_or_less second.
>
> 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
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21475#discussion_r1806828086
More information about the client-libs-dev
mailing list