8233696: [TESTBUG]Some jtreg tests fail when CAPS_LOCK is ON

Reviewed-by: serb, prr
This commit is contained in:
Jayathirth D V 2019-11-22 11:35:26 +05:30
parent 94116efd0c
commit 51837b8a13
5 changed files with 33 additions and 24 deletions
test/jdk
java/awt
SplashScreen/MultiResolutionSplash
Toolkit
LockingKeyStateTest
RealSync
javax/swing/JFileChooser/8041694

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -140,7 +140,8 @@ public class MultiResolutionSplashTest {
frame.dispose();
if (!textField.getText().equals("ab")) {
throw new RuntimeException("Focus is lost!");
throw new RuntimeException("Focus is lost! " +
"Expected 'ab' got " + "'" + textField.getText() + "'.");
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -164,7 +164,8 @@ public class UnixMultiResolutionSplashTest {
frame.dispose();
if (!textField.getText().equals("ab")) {
throw new RuntimeException("Focus is lost!");
throw new RuntimeException("Focus is lost! " +
"Expected 'ab' got " + "'" + textField.getText() + "'.");
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -103,21 +103,24 @@ public class LockingKeyStateTest {
}
void doTest() throws Exception{
robot.waitForIdle();
robot.mouseMove(frame.getLocationOnScreen().x + frame.getWidth() / 2,
frame.getLocationOnScreen().y + frame.getHeight() / 2);
robot.click();
try {
robot.waitForIdle();
robot.mouseMove(frame.getLocationOnScreen().x + frame.getWidth() / 2,
frame.getLocationOnScreen().y + frame.getHeight() / 2);
robot.click();
EventQueue.invokeAndWait( this::toggleAllTrue );
robot.waitForIdle(2000);
EventQueue.invokeAndWait( this::checkAllTrue );
EventQueue.invokeAndWait( this::toggleAllFalse );
robot.waitForIdle(2000);
EventQueue.invokeAndWait( this::checkAllFalse );
EventQueue.invokeAndWait( this::restoreAll );
robot.waitForIdle();
EventQueue.invokeAndWait( this::toggleAllTrue );
robot.waitForIdle(2000);
EventQueue.invokeAndWait( this::checkAllTrue );
EventQueue.invokeAndWait( this::toggleAllFalse );
robot.waitForIdle(2000);
EventQueue.invokeAndWait( this::checkAllFalse );
} finally {
EventQueue.invokeAndWait( this::restoreAll );
robot.waitForIdle();
frame.dispose();
frame.dispose();
}
}
public static void main(String argv[]) throws Exception {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -219,7 +219,8 @@ public class Test {
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
realSync(f);
asser("a".equals(b.getText()), "Wrong text: " + b.getText());
asser("a".equals(b.getText()), "Expected 'a' got " + "'" +
b.getText() + "'.");
f.dispose();
}
@ -242,7 +243,8 @@ public class Test {
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
realSync(f);
asser("a".equals(b.getText()), "Wrong text: " + b.getText());
asser("a".equals(b.getText()), "Expected 'a' got " + "'" +
b.getText() + "'.");
f.dispose();
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -101,9 +101,11 @@ public class bug8041694 {
"The selected directory is '%s'.", selectedDir.getAbsolutePath()));
if (selectedDir.getName().equals("d")) {
throw new RuntimeException(
"JFileChooser removed trailing spaces in the selected directory name.");
"JFileChooser removed trailing spaces in the selected directory name. " +
"Expected 'd ' got '" + selectedDir.getName() + "'.");
} else if (!selectedDir.getName().equals("d ")) {
throw new RuntimeException("The selected directory name is not the expected 'd '.");
throw new RuntimeException("The selected directory name is not "
+ "the expected 'd ' but '" + selectedDir.getName() + "'.");
}
} catch (UnsupportedLookAndFeelException | AWTException | IOException | InterruptedException e) {
throw new RuntimeException(e);