On Fri, 22 Nov 2024 19:24:28 GMT, Damon Nguyen <[email protected]> wrote:

> Test intermittently fails with a few different Exceptions. Initial report 
> shows `Choice can't be controlled by keyboard` when failing. An additional 
> report of an intermittent failure shows `Button does not have focus`.
> 
> Added some stability fixes. Additional delays, removed extraneous window, and 
> added an additional focus check.
> 
> Debugged using additional screenshots during different failure points. Looks 
> like sometimes the focus is still on the button. So, the delay has been added 
> afterwards. Test passes on 22.04 Ubuntu machine with 100 repeats in CI. Also 
> passed testing on all OS's with 50 repeats in CI.

test/jdk/java/awt/Focus/UnaccessibleChoice/AccessibleChoiceTest.java line 60:

> 58:     public static void main(final String[] args) throws Exception {
> 59:         AccessibleChoiceTest app = new AccessibleChoiceTest();
> 60:         app.test();

Since you are doing a bit of modifictaion to the test., you may think of 
modifying it further.
1. Don't think you need to create the object.
2. UI creation code can be moved to more meaningful method name 
`createAndShowUI instead of init` inside EDT block and followed by call to 
`test` method.

test/jdk/java/awt/Focus/UnaccessibleChoice/AccessibleChoiceTest.java line 102:

> 100: 
> 101:         // Focus default button and wait till it gets focus
> 102:         Point loc = def.getLocationOnScreen();

Should be accessed on EDT?
Frame and other UI components also should be created on EDT ?

test/jdk/java/awt/Focus/UnaccessibleChoice/AccessibleChoiceTest.java line 129:

> 127:         }
> 128: 
> 129:         // Press Down key to select next item in the choice(Motif 2.1)

Motif is deprecated.. can be removed
Suggestion:

        // Press Down key to select next item in the choice

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22333#discussion_r1857916947
PR Review Comment: https://git.openjdk.org/jdk/pull/22333#discussion_r1857886652
PR Review Comment: https://git.openjdk.org/jdk/pull/22333#discussion_r1857912472

Reply via email to