-
Notifications
You must be signed in to change notification settings - Fork 5.9k
8332901: Select{Current,New}ItemTest.java for Choice don't open popup on macOS #20601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8332901: Select{Current,New}ItemTest.java for Choice don't open popup on macOS #20601
Conversation
👋 Welcome back aivanov! A progress list of the required criteria for merging this PR into |
@aivanov-jdk This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 147 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@aivanov-jdk The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aivanov-jdk As you mentioned earlier this test fails on macOS 14.5 due to JDK-8322653, since it passes on CI (14.3 and 14.4) do we skip problemlisting the test for now ?
frame.addWindowListener(this); | ||
|
||
frame.setLocation(1,20); | ||
robot.mouseMove(10, 30); | ||
frame.setLocationRelativeTo(null); | ||
frame.pack(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When frame.setSize() is used, the mouse pointer on the choice drop-down button is no longer a resize indicator and the click event is received. But I guess you are planning to leave this as-is for now to test when the external fix is available for JDK-8322653
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When frame.setSize() is used, the mouse pointer on the choice drop-down button is no longer a resize indicator and the click event is received.
I don't understand how using frame.setSize
resolve the problem? Both pack
and setSize
call reshape
to apply the new location and size.
Did you mean frame.setResizable(false)
?
But I guess you are planning to leave this as-is for now to test when the external fix is available for JDK-8322653
We can modify this test to avoid JDK-8322653.
I added a panel to the frame to move the mouse cursor away from the edge of the frame while I verified the test would pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how using frame.setSize resolve the problem? Both pack and setSize call reshape to apply the new location and size.
When the frame width and height is increased then the mouse is no longer a resize indicator which makes the 1st click (on the choice dropdown button) work but the 2nd click on the choice item needs to be adjusted accordingly.
I believe frame.setResizable(false) or adding a panel as you suggested is a better and easier option.
We can modify this test to avoid JDK-8322653
Since there are already few tests problemlisted to track the external issue JDK-8322653, I think any of the above workarounds that you suggested can be added to avoid JDK-8322653. What do you think?
I'm unsure whether the test has ever run on 14.x in CI. The test has never failed for me when I submitted test jobs. As such, I have no reasons to problem-list it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well
Use latches to control test flow instead of delays and volatile variables.
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.
While I worked on another backport, I found I updated the other test too and refactored both of them to re-use common functionality. I moved both tests — Both updated tests pass in CI and locally on macOS 14.x. Non-resizable frame is used to work around JDK-8322653. I will update JBS issue and the description of the PR accordingly. |
Unfortunately, Git does not recognise the files are moved with so many additional changes. As a workaround, I can submit a new issue and integrate it where the files are moved only. This way we could preserve the history of the changes to the tests. Do you have any opinions? |
@aivanov-jdk Does it work if you move the test files using |
That's exactly what I did if you look at the history of the commits. It doesn't work in the code review. It won't work after integration either. After integration, individual commits are lost, everything is squashed into one changeset. The only reliable way to preserve the history across renames (and modification) is to integrate a separate changeset where the files are only renamed without any modifications. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
I believe the difference is close to negligible. Creating UI and waiting for it to be displayed likely takes more than compiling the test source code and starting a new JVM process.
Yes, I think it's cleaner this way. Each test does one thing and tests its own scenario. The old I found another test which tests the same scenario as |
/summary |
@aivanov-jdk Setting summary to:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated changes and summary looks good.
I submitted JDK-8339338 to remove |
/integrate |
Going to push as commit ef96a7b.
Your commit was automatically rebased without conflicts. |
@aivanov-jdk Pushed as commit ef96a7b. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
I looked at
java/awt/Choice/SelectCurrentItemTest/SelectCurrentItemTest.java
, ran it and noticed that the test does not open the popup of theChoice
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 receiveItemEvent
.I refactored both tests and moved them into
Choice/SelectItem
folder.SelectCurrentItemTest
encapsulates the common test logic and provides overridable methods to customise conditions forSelectNewItemTest
.Now,
SelectNewItemTest
extendsSelectCurrentItemTest
and overrides the conditions as well as the coordinates for clicking the popup of theChoice
component.The updated test fails for me locally on macOS Sonoma 14.5. This is likely the result of 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.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20601/head:pull/20601
$ git checkout pull/20601
Update a local copy of the PR:
$ git checkout pull/20601
$ git pull https://git.openjdk.org/jdk.git pull/20601/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20601
View PR using the GUI difftool:
$ git pr show -t 20601
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20601.diff
Webrev
Link to Webrev Comment