RFR: 8023263: [TESTBUG] Test closed/java/awt/Focus/InactiveWindowTest/InactiveFocusRace fails due to not enough time to initialize graphic components
Prasanta Sadhukhan
psadhukhan at openjdk.org
Wed Sep 10 03:58:09 UTC 2025
On Wed, 10 Sep 2025 03:13:53 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> test/jdk/java/awt/Focus/InactiveFocusRace.java line 109:
>>
>>> 107: }
>>> 108: });
>>> 109: inactiveFrame.setVisible(true);
>>
>> The previous version used a Semaphore to wait until the frame became active or the button received focus, but it didn’t check the second inactive frame.
>> I think what we should do is first show the "inactive" frame using the same Semaphore. Then, once it becomes visible, we should show another "active" frame.
>> This will ensure that the frame we intend to click below remains inactive/unfocused.
>
> I didn't get the "previous version"..I just added a delay between the UI creation and test start.
> Earlier also, init is called to do UI creation and then start is immediately called which sets
>
> inactiveFrame.setVisible(true);
> activeFrame.setVisible(true);
>
> All the semaphore logic is still the same after that
Test does
- renders inactiveFrame
- renders activeFrame
- wait for active frame to be active
- press on second button in inactive frame
- wait for second button should be focus owner
- Check Button2 should be the focus owner
I think the current test is also doing the same even now..
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27156#discussion_r2335482274
More information about the client-libs-dev
mailing list