-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8316627: JViewport Test headless failure #15847
8316627: JViewport Test headless failure #15847
Conversation
👋 Welcome back dnguyen! A progress list of the required criteria for merging this PR into |
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.
Thumbs up. This is a trivial fix and does not need to wait 24 hours.
@DamonGuy 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 no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
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.
How did this get through ? Was it not tested before pushing ?
And if a test needs "Robot" it surely expects a headful envt ?
In fact I am going to say that the problem here is using Robot at all.
You don't need to add headful, you just need to get rid of Robot which is just being used to do unnecessary Thread.sleep() calls.
I believe a review comment was suggested to change Thread.sleeps to robot delays after testing at some point. I did re-test what I thought were all the tests after moving them to open. @azvegint suggested the same change back to Thread.sleep. I have a current test ongoing for this change instead. Waiting for completion before updating the PR once more |
Given the CI test failure, this is probably the right fix so that it can be integrated quickly. As a follow-onto this, I see that PR #15802 deliberately tried to make this test headless by removing the unneeded |
No this is not the right fix. Do not push it. |
Ignore my comment. It crossed Phil's in the mail. |
Since this test doesn't display anything I don't see why it needs sleep at all If the test needs real events to fire then it would become quite different. And remember: testing avoids fire drills. |
}); | ||
robot.delay(500); | ||
sbar.addAdjustmentListener(e -> viewChanged = true); | ||
scrollpane.setViewportView(null); | ||
if (!viewChanged) { | ||
viewChanged = true; | ||
} |
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.
What purpose does viewChanged have ?
Its set but never read.
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 adjustmentListener therefore seems irrelevant too.
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.
Seems to me the test reduces to
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
public class bug4546474 {
public static void main(String[] args) {
JPanel panel = new JPanel();
JScrollPane scrollpane = new JScrollPane(panel,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JScrollBar sbar = scrollpane.getVerticalScrollBar();
scrollpane.setViewportView(null);
if (sbar.getVisibleAmount() > 0) {
throw new RuntimeException("Vertical scrollbar is not " +
"updated when viewport is replaced");
}
}
}
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 similarly. Thanks
import javax.swing.JPanel; | ||
import javax.swing.JScrollBar; | ||
import javax.swing.JScrollPane; | ||
import javax.swing.SwingUtilities; | ||
|
||
public class bug4546474 { | ||
static JScrollPane scrollpane; | ||
static JScrollBar sbar; |
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.
These two static vars can be local - you don't need to re-test, after that, just make sure it compiles.
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 does compile with the changes. Thanks for the quick advice
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.
Looks OK now. You can fix the statics if you like.
/integrate |
Going to push as commit c04c9ea. |
Converted test needs headful tag added to avoid failures.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15847/head:pull/15847
$ git checkout pull/15847
Update a local copy of the PR:
$ git checkout pull/15847
$ git pull https://git.openjdk.org/jdk.git pull/15847/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15847
View PR using the GUI difftool:
$ git pr show -t 15847
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15847.diff
Webrev
Link to Webrev Comment