From e48f7fa6ff8d448550b9251154dc8c9bfdcbc83e Mon Sep 17 00:00:00 2001 From: duke Date: Fri, 12 Jul 2024 09:24:02 +0000 Subject: [PATCH] Backport cec6c068b03d890312e50b448fbc26102c635249 --- .../java/awt/List/ActionEventTest/ActionEventTest.java | 9 +++++---- .../dnd/RecognizedActionTest/RecognizedActionTest.java | 5 +++-- .../jdk/javax/swing/JFileChooser/8041694/bug8041694.java | 4 ++-- .../jdk/javax/swing/JRadioButton/8033699/bug8033699.java | 2 +- test/jdk/javax/swing/JTable/4275046/bug4275046.java | 3 +++ 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/test/jdk/java/awt/List/ActionEventTest/ActionEventTest.java b/test/jdk/java/awt/List/ActionEventTest/ActionEventTest.java index 758f9ff479f..ecda27e4249 100644 --- a/test/jdk/java/awt/List/ActionEventTest/ActionEventTest.java +++ b/test/jdk/java/awt/List/ActionEventTest/ActionEventTest.java @@ -56,6 +56,7 @@ public ActionEventTest() { add(list); setSize(400,400); setLayout(new FlowLayout()); + setLocationRelativeTo(null); pack(); setVisible(true); } @@ -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."); @@ -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[]) { diff --git a/test/jdk/java/awt/dnd/RecognizedActionTest/RecognizedActionTest.java b/test/jdk/java/awt/dnd/RecognizedActionTest/RecognizedActionTest.java index 399236f17d1..ecd8709721f 100644 --- a/test/jdk/java/awt/dnd/RecognizedActionTest/RecognizedActionTest.java +++ b/test/jdk/java/awt/dnd/RecognizedActionTest/RecognizedActionTest.java @@ -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); @@ -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: diff --git a/test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java b/test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java index 3e3cb3b9658..23ed9163fa5 100644 --- a/test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java +++ b/test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java @@ -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() + "'."); } diff --git a/test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java b/test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java index 3168fe5ca06..06622f71819 100644 --- a/test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java +++ b/test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java @@ -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(); } } diff --git a/test/jdk/javax/swing/JTable/4275046/bug4275046.java b/test/jdk/javax/swing/JTable/4275046/bug4275046.java index e6c647ae778..78c80cc3557 100644 --- a/test/jdk/javax/swing/JTable/4275046/bug4275046.java +++ b/test/jdk/javax/swing/JTable/4275046/bug4275046.java @@ -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); @@ -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() { @@ -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) {