Skip to content
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

Closed

Conversation

DamonGuy
Copy link
Contributor

@DamonGuy DamonGuy commented Sep 20, 2023

Converted test needs headful tag added to avoid failures.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8316627: JViewport Test headless failure (Bug - P2)

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

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 20, 2023

👋 Welcome back dnguyen! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 20, 2023
@openjdk
Copy link

openjdk bot commented Sep 20, 2023

@DamonGuy The following label will be automatically applied to this pull request:

  • client

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.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Sep 20, 2023
@mlbridge
Copy link

mlbridge bot commented Sep 20, 2023

Webrevs

Copy link
Member

@dcubed-ojdk dcubed-ojdk left a 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.

@openjdk
Copy link

openjdk bot commented Sep 20, 2023

@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:

8316627: JViewport Test headless failure

Reviewed-by: dcubed, prr

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 master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 20, 2023
Copy link
Contributor

@prrace prrace left a 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.

@DamonGuy
Copy link
Contributor Author

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

@kevinrushforth
Copy link
Member

kevinrushforth commented Sep 20, 2023

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 JFrame. See this comment. What wasn't done is the removal of Robot, which is only being used for a sleep (and thus could be replaced with Thread.sleep). You might consider filing a low-priority follow-on bug to finish the job of making this test headless.

@prrace
Copy link
Contributor

prrace commented Sep 20, 2023

No this is not the right fix. Do not push it.

@kevinrushforth
Copy link
Member

Ignore my comment. It crossed Phil's in the mail.

@prrace
Copy link
Contributor

prrace commented Sep 20, 2023

Since this test doesn't display anything I don't see why it needs sleep at all
Nor does it need invokeAndWait.
Its a simple unit test.

If the test needs real events to fire then it would become quite different.
It would need to be shown in a JFrame etc and become a full headful test but that isn't apparent to me.

And remember: testing avoids fire drills.

});
robot.delay(500);
sbar.addAdjustmentListener(e -> viewChanged = true);
scrollpane.setViewportView(null);
if (!viewChanged) {
viewChanged = true;
}
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

@prrace prrace Sep 20, 2023

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");
    }
}

}

Copy link
Contributor Author

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

@prrace prrace left a 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.

@DamonGuy
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Sep 20, 2023

Going to push as commit c04c9ea.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 20, 2023
@openjdk openjdk bot closed this Sep 20, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 20, 2023
@openjdk
Copy link

openjdk bot commented Sep 20, 2023

@DamonGuy Pushed as commit c04c9ea.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants