Skip to content
Permalink
Browse files
8272232: javax/swing/JTable/4275046/bug4275046.java failed with "Expe…
…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 cec6c068b03d890312e50b448fbc26102c635249
Showing 5 changed files with 14 additions and 9 deletions.
@@ -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[]) {
@@ -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:
@@ -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() + "'.");
}
@@ -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();
}
}
@@ -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) {

1 comment on commit cec6c06

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on cec6c06 Sep 4, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.