Skip to content

Commit

Permalink
8272232: javax/swing/JTable/4275046/bug4275046.java failed with "Expe…
Browse files Browse the repository at this point in the history
…cted value in the cell: 'rededited' but found 'redEDITED'."

8257540: javax/swing/JFileChooser/8041694/bug8041694.java failed with "RuntimeException: The selected directory name is not the expected 'd ' but 'D '."

Reviewed-by: serb
  • Loading branch information
prsadhuk committed Sep 4, 2021
1 parent 14a3ac0 commit cec6c06
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
9 changes: 5 additions & 4 deletions test/jdk/java/awt/List/ActionEventTest/ActionEventTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public ActionEventTest() {
add(list);
setSize(400,400);
setLayout(new FlowLayout());
setLocationRelativeTo(null);
pack();
setVisible(true);
}
Expand All @@ -70,9 +71,9 @@ public void actionPerformed(ActionEvent ae) {

if ((md & expectedMask) != expectedMask) {

robot.keyRelease(KeyEvent.VK_ALT);
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.keyRelease(KeyEvent.VK_ALT);
dispose();
throw new RuntimeException("Action Event modifiers are not"
+ " set correctly.");
Expand All @@ -87,9 +88,9 @@ public void actionPerformed(ActionEvent ae) {
// Press Enter on list item, to generate action event.
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ALT);
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.keyRelease(KeyEvent.VK_ALT);
}

public static void main(String args[]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void init() {
dragGestureListener);

frame.getToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
Thread.sleep(100);

Expand Down Expand Up @@ -165,10 +166,10 @@ public void init() {
break;

case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.waitForIdle();
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.waitForIdle();
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.waitForIdle();
break;

default:
Expand Down
4 changes: 2 additions & 2 deletions test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ public void run() {
}
System.out.println(String.format(
"The selected directory is '%s'.", selectedDir.getAbsolutePath()));
if (selectedDir.getName().equals("d")) {
if (selectedDir.getName().toLowerCase().equals("d")) {
throw new RuntimeException(
"JFileChooser removed trailing spaces in the selected directory name. " +
"Expected 'd ' got '" + selectedDir.getName() + "'.");
} else if (!selectedDir.getName().equals("d ")) {
} else if (!selectedDir.getName().toLowerCase().equals("d ")) {
throw new RuntimeException("The selected directory name is not "
+ "the expected 'd ' but '" + selectedDir.getName() + "'.");
}
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ private static void hitKey(Robot robot, int keycode) {
private static void hitKey(Robot robot, int mode, int keycode) {
robot.keyPress(mode);
robot.keyPress(keycode);
robot.keyRelease(mode);
robot.keyRelease(keycode);
robot.keyRelease(mode);
robot.waitForIdle();
}
}
3 changes: 3 additions & 0 deletions test/jdk/javax/swing/JTable/4275046/bug4275046.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ private void createGUI() {
table.getColumnModel().getColumn(1).setCellEditor(comboEditor);

frame.add(table);
frame.setLocationRelativeTo(null);
frame.pack();
frame.setSize(550, 400);
frame.setVisible(true);
Expand Down Expand Up @@ -117,6 +118,7 @@ public void run() {

private void runTest() throws Exception {
robot.waitForIdle();
robot.delay(1000);

// Click the first cell in the "color" column
SwingUtilities.invokeAndWait(new Runnable() {
Expand Down Expand Up @@ -175,6 +177,7 @@ private void checkResult() throws Exception {
public void run() {
// Read the edited value of from the cell
editedValue = table.getModel().getValueAt(0, 1);
editedValue = ((String)editedValue).toLowerCase();
System.out.println("The edited value is = " + editedValue);
testResult = editedValue.equals(EXPECTED_VALUE);
if (testResult) {
Expand Down

3 comments on commit cec6c06

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@luchenlin
Copy link

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on cec6c06 Jul 12, 2024

Choose a reason for hiding this comment

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

@luchenlin the backport was successfully created on the branch backport-luchenlin-cec6c068-master in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit cec6c068 from the openjdk/jdk repository.

The commit being backported was authored by Prasanta Sadhukhan on 4 Sep 2021 and was reviewed by Sergey Bylokhov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git backport-luchenlin-cec6c068-master:backport-luchenlin-cec6c068-master
$ git checkout backport-luchenlin-cec6c068-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git backport-luchenlin-cec6c068-master

Please sign in to comment.