Integrated: 8332901: Select{Current, New}ItemTest.java for Choice don't open popup on macOS
Alexey Ivanov
aivanov at openjdk.org
Wed Sep 4 16:40:26 UTC 2024
On Thu, 15 Aug 2024 18:02:33 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.
This pull request has now been integrated.
Changeset: ef96a7b0
Author: Alexey Ivanov <aivanov at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/ef96a7b014795f366af3a90ef8f474cfb621197f
Stats: 593 lines in 5 files changed: 276 ins; 317 del; 0 mod
8332901: Select{Current,New}ItemTest.java for Choice don't open popup on macOS
Move SelectCurrentItemTest.java to java/awt/Choice/SelectItem/.
Move SelectNewItemTest.java to java/awt/Choice/SelectItem/.
Use latches to control test flow instead of delays.
Encapsulate the common logic in SelectCurrentItemTest.
Provide overridable checkXXX() methods to modify conditions.
Provide an overridable method which defines where to click
in the choice popup to select an item.
Reviewed-by: honkar, prr, dnguyen
-------------
PR: https://git.openjdk.org/jdk/pull/20601
More information about the client-libs-dev
mailing list