changeset 17301:c3510eed2d61

8144709: [hidpi] [TestBug] java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java, java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java are failing Reviewed-by: alexsch, rchamyal
author pkbalakr
date Fri, 22 Jul 2016 12:16:33 +0530
parents e7b77766b1ce
children 287e559361ae
files test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java
diffstat 2 files changed, 26 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java	Fri Jul 22 12:13:24 2016 +0530
+++ b/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java	Fri Jul 22 12:16:33 2016 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, 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
@@ -34,14 +34,13 @@
  *          depending on the preferred sizes and gaps and click the cornors
  *          of the components to check if events are triggered
  * @library ../../../../lib/testlibrary/
- * @build ExtendedRobot
  * @run main ChangeGridSize
  * @run main ChangeGridSize -hg 20 -vg 20
  */
 
 public class ChangeGridSize {
 
-    private int width = 200;
+    private int width = 300;
     private int height = 200;
     private final int hGap, vGap;
     private final int rows = 3;
@@ -51,7 +50,7 @@
     private Button[] buttons;
     private Frame frame;
 
-    private ExtendedRobot robot;
+    private Robot robot;
     private GridLayout layout;
 
     private volatile boolean actionPerformed = false;
@@ -59,7 +58,7 @@
     public ChangeGridSize(int hGap, int vGap) throws Exception  {
         this.hGap = hGap;
         this.vGap = vGap;
-        robot = new ExtendedRobot();
+        robot = new Robot();
         EventQueue.invokeAndWait( () -> {
             frame = new Frame("Test frame");
             frame.setSize(width, height);
@@ -123,10 +122,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the left top of button did not trigger action event");
+        }
 
         actionPerformed = false;
         robot.mouseMove(bottomRightX, bottomRightY);
@@ -134,10 +135,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the bottom right of button did not trigger action event");
+        }
     }
 
     private void doTest() throws Exception {
@@ -155,6 +158,7 @@
         for (int i = 0; i < buttons.length; i++) {
             if (buttons[i].getSize().width != componentWidth ||
                     buttons[i].getSize().height != componentHeight) {
+                frame.dispose();
                 throw new RuntimeException(
                         "FAIL: Button " + i + " not of proper size" +
                         "Expected: " + componentWidth + "*" + componentHeight +
--- a/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java	Fri Jul 22 12:13:24 2016 +0530
+++ b/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java	Fri Jul 22 12:16:33 2016 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, 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
@@ -34,14 +34,13 @@
  *          depending on the preferred sizes and gaps and click the cornors
  *          of the components to check if events are triggered
  * @library ../../../../lib/testlibrary/
- * @build ExtendedRobot
  * @run main ComponentPreferredSize
  * @run main ComponentPreferredSize -hg 20 -vg 20
  */
 
 public class ComponentPreferredSize {
 
-    private int width = 200;
+    private int width = 300;
     private int height = 200;
     private final int hGap, vGap;
     private final int rows = 3;
@@ -51,7 +50,7 @@
     private Button[] buttons;
     private Frame frame;
 
-    private ExtendedRobot robot;
+    private Robot robot;
     private GridLayout layout;
 
     private volatile boolean actionPerformed = false;
@@ -59,7 +58,7 @@
     public ComponentPreferredSize(int hGap, int vGap) throws Exception {
         this.hGap = hGap;
         this.vGap = vGap;
-        robot = new ExtendedRobot();
+        robot = new Robot();
         EventQueue.invokeAndWait( () -> {
             frame = new Frame("Test frame");
             frame.setSize(width, height);
@@ -116,10 +115,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the left top of button did not trigger action event");
+        }
 
         actionPerformed = false;
         robot.mouseMove(bottomRightX, bottomRightY);
@@ -127,10 +128,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the bottom right of button did not trigger action event");
+        }
     }
 
     private void doTest() throws Exception {
@@ -147,6 +150,7 @@
         for (int i = 0; i < buttons.length; i++) {
             if (buttons[i].getSize().width != componentWidth ||
                     buttons[i].getSize().height != componentHeight) {
+                frame.dispose();
                 throw new RuntimeException(
                         "FAIL: Button " + i + " not of proper size" +
                         "Expected: " + componentWidth + "*" + componentHeight +