RFR: 8332901: Select{Current,New}ItemTest.java for Choice don't open popup on macOS [v4]

Harshitha Onkar honkar at openjdk.org
Tue Aug 20 17:51:03 UTC 2024


On Tue, 20 Aug 2024 14:47:23 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> I looked at `java/awt/Choice/SelectCurrentItemTest/SelectCurrentItemTest.java`, ran it and noticed that the test does not open the popup of the `Choice` component on macOS 14.x.
>> 
>> If the popup does not open, the test does not verify anything — it always passes.
>> 
>> I refactored the test and added a mouse listener to the `Choice` component. If mouse click isn't registered, the test fails.
>> 
>> Later, I found a similar test: `test/jdk/java/awt/Choice/SelectNewItemTest/SelectNewItemTest.java`. It clicks on another item in the Choice popup and expects to receive `ItemEvent`.
>> 
>> I refactored both tests and moved them into `Choice/SelectItem` folder.
>> 
>> `SelectCurrentItemTest` encapsulates the common test logic and provides overridable methods to customise conditions for `SelectNewItemTest`.
>> 
>> Now, `SelectNewItemTest` extends `SelectCurrentItemTest` and overrides the conditions as well as the coordinates for clicking the popup of the `Choice` component.
>> 
>> ~~The updated test fails for me locally on macOS Sonoma 14.5. This is likely the result of [JDK-8322653](https://bugs.openjdk.org/browse/JDK-8322653): _[macos14] : Mouse clicks are not received within 3 pixels of the window boundary_.~~
>> 
>> To work around JDK-8322653, both tests use non-resizable frame. Both updated tests pass on CI and locally on macOS 14.5. This is why I removed `SelectNewItemTest` from problem-list.
>
> Alexey Ivanov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Amend the copyright year in SelectCurrentItemTest

LGTM 

Ideally these two tests can be combined since they are very similar and it also means one test less to run on CI.
But since you are reusing the `SelectCurrentItemTest` test code and overriding the methods, this approach is cleaner and doesn't make the test complicated.

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

Marked as reviewed by honkar (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20601#pullrequestreview-2248662075


More information about the client-libs-dev mailing list