Skip to content

Commit

Permalink
Backport cec6c068b03d890312e50b448fbc26102c635249
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Jul 12, 2024
1 parent 55bbe06 commit e48f7fa
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

0 comments on commit e48f7fa

Please sign in to comment.