RFR: 8368185: Test javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java failed: Synth ButtonUI does not handle PRESSED & MOUSE_OVER state

Alexey Ivanov aivanov at openjdk.org
Fri Oct 3 09:38:46 UTC 2025


On Fri, 3 Oct 2025 06:08:38 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> test/jdk/javax/swing/plaf/synth/SynthButtonUI/6276188/bug6276188.java line 92:
>> 
>>> 90:             robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
>>> 91:             robot.waitForIdle();
>>> 92:             robot.delay(2000);
>> 
>> I wonder if syncing with `mousePressed` event handler on the button and adding a little delay after `mousePressed` is triggered would allow for smaller delay. Anyway, using an event handler will *guarantee*, the same handler is called in `ButtonUI`. We will still need a delay to allow the button UI delegate to handle the event and to repaint the button, yet that delay less than 2 seconds would be enough.
>
> Since the color change to Red will happen on MOUSE_PRESSED and MOUSE_OVER state, I wanted to give it more time to be in red color state so that robot can pick the color..
> The failure was that it was picking up Green color even though the CI failure artifact shows background is Red

Yes, I got this… A delay of 2 seconds on each run means the test will *always* wait for 2 seconds even if the update occurred in 0.1 seconds.

It's fine as it is, yet I'd rather use a better synchronisation to allow the test to complete quicker, at the very least I'd investigate whether it's possible and whether the more complicated logic in the test gives a time bonus as the result.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27444#discussion_r2401369318


More information about the client-libs-dev mailing list