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
7190978: javax/swing/JComponent/7154030/bug7154030.java fails on mac #955
Conversation
👋 Welcome back psadhukhan! A progress list of the required criteria for merging this PR into |
Webrevs
|
@@ -50,7 +52,7 @@ | |||
* @library /lib/client/ | |||
* @build Util | |||
* @build ExtendedRobot | |||
* @run main bug7154030 | |||
* @run main/othervm -Dsun.java2d.uiScale=1 bug7154030 |
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.
The "sun.java2d.uiScale" does not affect the sizes of the frame on macOS, Is it possible that it was reported on HiDPI screen macOS?
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.
It was reported in macmini (probably connect to hidpi screen) and iMac (I guess having hidpi screen).
Also, I have seen mach5 job failing on windows too.
I have posted failing mach5 jobs in JBS.
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.
Then please double-check that the test will pass after the fix on HiDPI screen. Not sure that -Dsun.java2d.uiScale=1 affects such usecase.
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.
Since mach5 systems are mostly macmini, where it initially failed, and the resultant test is passing on them, I would hope they will pass on hidpi screen they are connected 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.
The mach5 macOS test systems currently have ZERO hidpi monitors. I think they are all 1920x1080 non-retina.
They only ever had at most one and that was because it was accidentally connected that way after a lab move.
Removed uiScale and move frame from (0,0) location to about mid-screen and made sure robot screenCapture also captures the frame from that location. mach5 iterations is green. |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); | ||
locx = screenSize.width/2; | ||
locy = screenSize.height/2; | ||
frame.setLocation(locx, locy); |
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.
To move it to the center you can use, setLocationRelativeTo(null) and you will need to get the actual bounds of the window(locx and locy might be ignored/tweaked by the OS)
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 know setLocationRelativeTo(null) will move to center of screen but I needed the coordinate for robot interaction.
The locx,locy calculation to move to center of screen is done intentionally as we need to use the same coordinate in robot to capture the screen
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.
The locx,locy calculation to move to center of screen is done intentionally as we need to use the same coordinate in robot to capture the screen
You can use locx/loxy intentionally to move the window, but you can't use it in a robot because of:
you will need to get the actual bounds of the window(locx and locy might be ignored/tweaked by the OS)
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.
Modified to use bounds.
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.
GC.getBounds() and Toolkit.getScreenSize() return the same bounds, but the bounds of the screen, not the window bounds.
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 guess we need the screen bounds only, no? I guess by window bounds, u mean frame bounds which is anyway set to 300,300 which I did not change.
If not, can you say which API to use?
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.
Used window bounds...Please let me know if any other comments.
frame.setVisible(true); | ||
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); | ||
} | ||
}); | ||
|
||
robot.waitForIdle(500); | ||
imageInit = robot.createScreenCapture(new Rectangle(0, 0, 300, 300)); |
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.
The usage of size 300x300 has the same issues as locx/locy before. It is part of the window bounds.
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.
but 300x300 is set in frame setSize..if I use frame getBounds instead of already set 300x300, that will not be right, according to me...What if getBounds() has some bug (in some platform) and return some other width/height (say 1 pixel less, we might have similar bug in 8196465) that what is set in setSize, then the test might pass even though robot is capturing wrong bounds.
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.
but 300x300 is set in frame setSize..if I use frame getBounds instead of already set 300x300, that will not be right, according to me...
The test should set the size 300,300 to the frame and then request and use the real bounds of the frame.
What if getBounds() has some bug (in some platform) and return some other width/height (say 1 pixel less, we might have similar bug in 8196465) that what is set in setSize, then the test might pass even though robot is capturing wrong bounds.
The getBounds() simply returns the size which was set by the native system, so is it a bug in getBounds() or the real bounds of the frame "say 1 pixel less"?
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.
Any further feedback?
@prsadhuk 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 201 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 |
/integrate |
@prsadhuk Since your change was applied there have been 203 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 5181f9c. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Please review a test fix for an issue seen where robot image capture is wrong if screen scale factor is more, which could result in button or frame to move out of captured dimension of 300,300.
Fixed by setting uiScale=1 in the test which can still reproduce JDK-7154030.
Mach5 job has been run for several iterations in all platforms. Link in JBS.
Progress
Testing
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/955/head:pull/955
$ git checkout pull/955