RFR: 8305427: Write a test Check whether focus changes as expected when requestFocus is used to traverse randomly around the window [v2]

lawrence.andrews duke at openjdk.org
Fri Apr 7 22:42:45 UTC 2023


On Wed, 5 Apr 2023 11:47:06 GMT, Ravi Gupta <duke at openjdk.org> wrote:

>> This testcase Checking whether the Component becoming the Focus Owner and FocusEvent.FOCUS_GAINED will be received by the Component when the focus is requested on the component using requestFocus.
>> 
>> Testing:
>> Tested using Mach5(20 times per platform) in macos,linux and windows and got all pass.
>
> 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

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13293#discussion_r1161003435



More information about the client-libs-dev mailing list