changeset 60287:69495f2ee5ba

8240202: A few client tests leave mouse buttons pressed Reviewed-by: prr
author serb
date Fri, 28 Feb 2020 16:49:10 -0800
parents 965c0a1421e5
children ed5224c3e044
files test/jdk/ProblemList.txt test/jdk/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java test/jdk/javax/swing/JButton/PressedButtonRightClickTest.java
diffstat 3 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/ProblemList.txt	Thu Feb 27 09:49:33 2020 +0000
+++ b/test/jdk/ProblemList.txt	Fri Feb 28 16:49:10 2020 -0800
@@ -155,7 +155,7 @@
 java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java 8049405 macosx-all
 java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java 8048171 generic-all
 java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java 8159451 linux-all,windows-all,macosx-all
-java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java 8194765 generic-all
+java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java 6986109 generic-all
 java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java 6986109 windows-all
 java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java 8049405 generic-all
 java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java 8049405 macosx-all
--- a/test/jdk/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java	Thu Feb 27 09:49:33 2020 +0000
+++ b/test/jdk/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java	Fri Feb 28 16:49:10 2020 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, 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
@@ -119,12 +119,12 @@
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mouseMove(splitterLoc.x - 50, splitterLoc.y);
         Color c = robot.getPixelColor(splitterLoc.x - 50, splitterLoc.y);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
         System.out.println("Actual: "+c+", (not) expected: "+AWT_VERIFY_COLOR+" at "+(splitterLoc.x - 50)+", "+ splitterLoc.y);
         if (!ignoreFail && c.equals(AWT_VERIFY_COLOR)) {
             fail("The JSplitPane drag-n-drop image did not pass pixel color check and is overlapped");
         }
-        robot.mouseRelease(InputEvent.BUTTON1_MASK);
-
         clickAndBlink(robot, splitterLoc);
 
         return clicked;
--- a/test/jdk/javax/swing/JButton/PressedButtonRightClickTest.java	Thu Feb 27 09:49:33 2020 +0000
+++ b/test/jdk/javax/swing/JButton/PressedButtonRightClickTest.java	Fri Feb 28 16:49:10 2020 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, 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
@@ -89,7 +89,9 @@
         testRobot.delay(1000);
 
         // Test whether the button is still pressed
-        if (myButton.getModel().isPressed() == false) {
+        boolean pressed = myButton.getModel().isPressed();
+        testRobot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+        if (!pressed) {
             disposeTestUI();
             throw new RuntimeException("Test Failed!");
         }
@@ -107,6 +109,7 @@
         myFrame.add(myButton, BorderLayout.CENTER);
         myFrame.setSize(400, 300);
         myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        myFrame.setLocationRelativeTo(null);
         myFrame.setVisible(true);
     }
 }