-
Notifications
You must be signed in to change notification settings - Fork 5.9k
8352149: Test java/awt/Frame/MultiScreenTest.java fails: Window list is empty #24752
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
base: master
Are you sure you want to change the base?
Conversation
/covered |
👋 Welcome back kboulanou! A progress list of the required criteria for merging this PR into |
You are already a known contributor! |
@kboulanou 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 3 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@sendaoYan, @kumarabhi006, @aivanov-jdk) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
@kboulanou 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. |
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.
Copy right year should be updated.
Webrevs
|
} | ||
GraphicsConfiguration[] gc = primaryDevice.getConfigurations(); | ||
if (gc.length > 0) { |
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.
Why did you remove the for-loop?
I tested your changes on multi-monitor system on Linux platform but don't see any frames created for second screen. There is only one frame created for primary screen.
This test was failing on Solaris platform as per JDK-4312921 and the test should create multiple frames on second screen. I converted the test from applet to manual test under this issue. As per original applet test instruction, I couldn't check this test on all platforms (didn't have the multi-monitor setup) and made this to run on all platforms but I think this test should be restricted to run only on Linux machine. I ran the test (without your fix) on Windows, Mac and Linux platform. It failed on Windows and Mac but no issues on Linux. I suggest to revert back the changes and restrict the test to run only on Linux machine. |
Changes reverted Copyright year updated. |
Please update the title of the PR to |
PR title updated |
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.
The test doesn't work on Linux either. The problem on Linux is that there are too many graphics configurations are returned. On my Fedora Linux 42 with two monitors, It could be the reason why the loop divides the number of configurations: In the end, this loop creates 176 windows and a thread for each of the windows. This hangs GNOME shell completely. A few times, I was able to kill the I'm sure this problem was discussed somewhere… (I'll search for that discussion later.) We should limit testing to default configurations only. As for Windows, the test could be usable on Windows and macOS if you remove replace |
I tested on Ubuntu 22.04 and don't find any issues. I agree that Since the original bug was raised for Solaris, I suggested to drop the testing for Windows and Mac. As per the bug description, @aivanov-jdk If we replace |
I'm pretty sure it depends on hardware: how many configurations are returned and how easy the OS and CPU can handle lots of threads.
I don't see how such a huge number of windows can possibly improve testing. I'd say testing the default configuration which is the current one for the screen should be enough.
I do not think so.
As it looks, the test isn't valuable in its current state either way. I don't think we'll be able to reproduce the original problem, yet it may be possible. The bug description states,
Then Phil says in his comment,
This could indicate that the issue is for Solaris only. However, So, it's unclear whether the test could reproduce the original problem on Solaris. If it doesn't, removing the test is the solution. |
I removed the test initially but later on added as it was suggested to test it for Linux. |
@aivanov-jdk In that case, test can be modified to run for default configuration for all platforms. |
It was in #21942, its description reads
The updated code reduces the number of tested graphics configurations to 10: jdk/test/jdk/java/awt/Graphics2D/ScaledTransform/ScaledTransform.java Lines 58 to 62 in edf8ce8
|
Thanks @aivanov-jdk for suggesting the correct route. @kboulanou Please modify the test to run for all platforms and you can limit the number of graphics configuration to 10 for linux. |
@kumarabhi006 Changes done and tested on MacOS. Will test on Linux and Windows next. |
Updates to this PR: |
Why it fails on win/mac? |
On Win/mac, graphic configuration return value is 1 and then there is no frame created as gc.length/2 evaluates to 0. |
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.
You may remove setting the title for instruction
and row count
for PassFailJFrame.
JFrame f = new JFrame(gc[i]); //test JFrame( gc ) | ||
GCCanvas c = new GCCanvas(gc[i]);//test canvas( gc ) | ||
Rectangle gcBounds = gc[i].getBounds(); //test getBounds() | ||
GCCanvas c = new GCCanvas(gc[i]);// test canvas( gc ) |
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.
For consistency
GCCanvas c = new GCCanvas(gc[i]);// test canvas( gc ) | |
GCCanvas c = new GCCanvas(gc[i]); // test canvas( gc ) |
@@ -99,21 +99,22 @@ public List<JFrame> init() { | |||
for (int j = 0; j < gs.length; j++) { | |||
GraphicsConfiguration[] gc = gs[j].getConfigurations(); | |||
if (gc.length > 0) { | |||
for (int i = 0; i < gc.length / 2; i++) { | |||
for (int i = 0; i < gc.length && i < 10; i++) { | |||
JFrame f = new JFrame(gc[i]); //test JFrame( gc ) |
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.
JFrame f = new JFrame(gc[i]); //test JFrame( gc ) | |
JFrame f = new JFrame(gc[i]); // test JFrame( gc ) |
int xoffs = gcBounds.x; | ||
int yoffs = gcBounds.y; | ||
|
||
f.getContentPane().add(c); | ||
f.setTitle("Screen# " + Integer.toString(j) + ", GC#" + Integer.toString(i)); | ||
f.setSize(300, 200); | ||
f.setLocation(400 + xoffs, (i * 150) + yoffs);//test displaying in right location | ||
f.setLocation(400 + xoffs, (i * 150) + yoffs);// test |
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.
f.setLocation(400 + xoffs, (i * 150) + yoffs);// test | |
f.setLocation(400 + xoffs, (i * 150) + yoffs); // test |
@@ -173,7 +175,7 @@ public void paint( Graphics _g ) { | |||
g.setColor(Color.cyan); | |||
g.fillArc(150, 30, 30, 30, 0, 200); | |||
} | |||
|
|||
@Override |
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.
You may add a blank line before @Override
line to maintain consistency. Also add 4 spaces to move @Override
similar to other methods
@Override | |
@Override |
@kumarabhi006 I made changes as you requested. Thanks. |
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.
There are other code clean-up that can be done, but these issues are close to lines which are modified.
f.setLocation(400 + xoffs, (i * 150) + yoffs); // test | ||
// displaying in right location |
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.
f.setLocation(400 + xoffs, (i * 150) + yoffs); // test | |
// displaying in right location | |
// test displaying in right location | |
f.setLocation(400 + xoffs, (i * 150) + yoffs); |
The comment applies to this line, however, does it add anything, does it clarify anything? Should we remove the comment?
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.
Comment cleanup done, pending decision about its removal.
.testUI(obj::init) | ||
.build() |
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.
.testUI(obj::init) | |
.build() | |
.testUI(obj::init) | |
.positionTestUI(MultiScreenTest::positionTestWindows) | |
.build() |
where
private static void positionTestWindows(List<Window> testWindows,
PassFailJFrame.InstructionUI instructionUI) {
// Do nothing - the location of each window is set when they're created
}
This allows keeping both created frames / windows Screen#
and DitherTest GC#
together for each screen.
Perhaps, such a null layout should be added as library method into WindowLayouts.java
.
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.
Method created and code updated.
@aivanov-jdk updates made as suggested. Thanks. |
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.
Just minor comments.
Update the subject of the PR to align with the JBS subject.
Title updated as requested. |
@aivanov-jdk May I go ahead and issue integrate command to this PR ? |
Yes. I'll leave the PR open for a while before I sponsor it to give anyone else to look at the updated code. |
/integrate |
@kboulanou |
Fixes issue in which the test fails when run on multi-screen machine.
Tested on Ubuntu 24.04, MacOS 15 and Windows 11
JTREG
runner starting test: java/awt/Frame/MultiScreenTest.java
runner finished test: java/awt/Frame/MultiScreenTest.java
Passed. Execution successful
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24752/head:pull/24752
$ git checkout pull/24752
Update a local copy of the PR:
$ git checkout pull/24752
$ git pull https://git.openjdk.org/jdk.git pull/24752/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24752
View PR using the GUI difftool:
$ git pr show -t 24752
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24752.diff
Using Webrev
Link to Webrev Comment