Skip to content
Permalink
Browse files

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

Reviewed-by: serb, prr
  • Loading branch information
jayathirthrao committed Nov 22, 2019
1 parent 94116ef commit 51837b8a13d24279b8f9a1e36dee7320901a9cc9
@@ -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 @@ static void testFocus() throws Exception {
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 @@ static void testFocus() throws Exception {

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 void createGui() {
}

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 static void testType() {
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 static void testTypeSwing() {
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 void run() {
"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);

0 comments on commit 51837b8

Please sign in to comment.
You can’t perform that action at this time.