RFR: 8343736: Test java/awt/Focus/UnaccessibleChoice/AccessibleChoiceTest.java failed: Choice can't be controlled by keyboard [v2]

Damon Nguyen dnguyen at openjdk.org
Thu Nov 28 01:19:33 UTC 2024


On Tue, 26 Nov 2024 01:09:41 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

> These are on unchanged lines.
> 
> Do we need a delay of 1 sec on line#145?
> 
> if (choice.getSelectedItem() != choice.getItem(1)) - This needs to be changed to !choice.getSelectedItem().equals(choice.getItem(1))) as it a string comparison.

Updated to use string comparison `equals()` instead.

> test/jdk/java/awt/Focus/UnaccessibleChoice/AccessibleChoiceTest.java line 55:
> 
>> 53:     Frame frame = new Frame("Accessible Choice Test Frame");
>> 54:     Choice choice = new Choice();
>> 55:     Button def = new Button("default owner");
> 
> More meaningful variable name? or may be `button` would also work
> 
> Suggestion:
> 
>     Button defaultOwner = new Button("default owner");

Done

> test/jdk/java/awt/Focus/UnaccessibleChoice/AccessibleChoiceTest.java line 103:
> 
>> 101:         // Focus default button and wait till it gets focus
>> 102:         Point loc = def.getLocationOnScreen();
>> 103:         robot.mouseMove(loc.x + 5, loc.y + 5);
> 
> For test stability it is better to move the click to the center of the button.
> 
> robot.mouseMove(loc.x + def.getWidth() / 2, loc.y + def.getHeight() / 2);

Sure. Modified.

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

PR Comment: https://git.openjdk.org/jdk/pull/22333#issuecomment-2505081806
PR Review Comment: https://git.openjdk.org/jdk/pull/22333#discussion_r1861392732
PR Review Comment: https://git.openjdk.org/jdk/pull/22333#discussion_r1861392919


More information about the client-libs-dev mailing list