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

8354214: Open source Swing tests Batch 2 #24588

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jayathirthrao
Copy link
Member

@jayathirthrao jayathirthrao commented Apr 11, 2025

Few swing JList tests are open sourced.


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-8354214: Open source Swing tests Batch 2 (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24588/head:pull/24588
$ git checkout pull/24588

Update a local copy of the PR:
$ git checkout pull/24588
$ git pull https://git.openjdk.org/jdk.git pull/24588/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24588

View PR using the GUI difftool:
$ git pr show -t 24588

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24588.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 11, 2025

👋 Welcome back jdv! 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
Copy link

openjdk bot commented Apr 11, 2025

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

8354214: Open source Swing tests Batch 2

Reviewed-by: honkar

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 14 new commits pushed to the master branch:

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 11, 2025
@openjdk
Copy link

openjdk bot commented Apr 11, 2025

@jayathirthrao 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 Apr 11, 2025
@mlbridge
Copy link

mlbridge bot commented Apr 11, 2025

Webrevs

private static CountDownLatch listGainedFocusLatch;
public static void main(String[] args) throws Exception {
try {
listGainedFocusLatch = new CountDownLatch(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it might be better to initialise it directly on line 52?

private static CountDownLatch listGainedFocusLatch = new CountDownLatch(1);

}
});

list = new JList(new String[] {"one", "two", "three", "four"});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it might be easier to read if this is initialised on line 49?

private static final JList list = new JList(new String[] {"one", "two", "three", "four"});

and the same for line 69 f = new JFrame("bug4618767");

I feel it is going to be easier to read if global variables were initialised at class level when possible, especially if they are not reassigned further. This way they can also be finalised. But if you feel it's ok as it is, I'm fine with it.

* @bug 4618767
* @summary First letter navigation in JList interferes with mnemonics
* @key headful
* @run main bug4618767
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: is this line necessary?

Copy link
Contributor

@honkar-jdk honkar-jdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM apart from minor suggestion added inline

.title("bug4193267 Instructions")
.instructions(INSTRUCTIONS)
.columns(35)
.testUI(initialize())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PassFailJFrame's .positionTestUI(WindowLayouts::rightOneRow) can be used to position multiple windows side by side.

private static JFrame f;
private static JList list;
private static boolean menuSelected;
private static boolean failed;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is accessed on two different threads.

Suggested change
private static boolean failed;
private static volatile boolean failed;

" focus for list");
}
Robot robot = new Robot();
robot.setAutoDelay(500);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reduce autoDelay to a smaller number?

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 11, 2025
lst.setVisibleRowCount(4);
jsp = new JScrollPane(lst);
fr[0].add(jsp);
fr[0].setSize(400,200);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fr[0].setSize(400,200);
fr[0].setSize(400, 200);

fr[0].setSize(400,200);

JPanel pL = new JPanel();
pL.setLayout(new GridLayout(2,1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pL.setLayout(new GridLayout(2,1));
pL.setLayout(new GridLayout(2, 1));

pL.add(new JLabel("Last Visible Index"));

JPanel p = new JPanel();
p.setLayout(new GridLayout(2,1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
p.setLayout(new GridLayout(2,1));
p.setLayout(new GridLayout(2, 1));

p.add(last);

fr[1] = new JFrame("Index");
fr[1].setSize(200,200);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fr[1].setSize(200,200);
fr[1].setSize(200, 200);

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 ready Pull request is ready to be integrated rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants