RFR: 8305427: Write a test Check whether focus changes as expected when requestFocus is used to traverse randomly around the window [v2]
Ravi Gupta
duke at openjdk.org
Thu Apr 20 07:20:59 UTC 2023
On Fri, 7 Apr 2023 22:39:54 GMT, lawrence.andrews <duke at openjdk.org> wrote:
>> Ravi Gupta has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8305427: code formatting
>
> test/jdk/java/awt/Focus/RequestFocusOwnerTest/RequestFocusOwnerTest.java line 144:
>
>> 142: robot.waitForIdle();
>> 143:
>> 144: if (!requestStatus) {
>
> According to the requestFocusInWindow() documentation https://docs.oracle.com/en/java/javase/20/docs/api/java.desktop/java/awt/Component.html#requestFocusInWindow() . Developers must never assume that this Component is the focus owner until this Component receives a FOCUS_GAINED event.
>
> So dn't depend on requestFocusInWindow() return value
Modified the test to wait until the FOCUS_GAINED event over for the components i am expecting for focus to be gained.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13293#discussion_r1172177723
More information about the client-libs-dev
mailing list