8146168: [TEST_BUG] instability of java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java
authorarapte
Wed, 30 Dec 2015 19:28:05 +0300
changeset 35659 ae936857454f
parent 35658 48bccfa61aef
child 35660 471caf9d2ac0
8146168: [TEST_BUG] instability of java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java Reviewed-by: serb, rchamyal
jdk/test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java
--- a/jdk/test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java	Tue Dec 29 10:40:43 2015 -0500
+++ b/jdk/test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java	Wed Dec 30 19:28:05 2015 +0300
@@ -32,7 +32,7 @@
 
 /**
  * @test
- * @bug 8007219
+ * @bug 8007219 8146168
  * @author Alexander Scherbatiy
  * @summary Frame size reverts meaning of maximized attribute
  * @run main MaximizedToMaximized
@@ -41,7 +41,8 @@
 
     public static void main(String[] args) throws Exception {
 
-       Frame frame = new Frame();
+        Frame frame = new Frame();
+        Robot robot = new Robot();
         final Toolkit toolkit = Toolkit.getDefaultToolkit();
         final GraphicsEnvironment graphicsEnvironment =
                 GraphicsEnvironment.getLocalGraphicsEnvironment();
@@ -62,13 +63,15 @@
         frame.setBounds(availableScreenBounds.x, availableScreenBounds.y,
                 availableScreenBounds.width, availableScreenBounds.height);
         frame.setVisible(true);
+        robot.waitForIdle();
 
         Rectangle frameBounds = frame.getBounds();
         frame.setExtendedState(Frame.MAXIMIZED_BOTH);
-        Robot robot = new Robot();
         robot.waitForIdle();
 
         Rectangle maximizedFrameBounds = frame.getBounds();
+
+        frame.dispose();
         if (maximizedFrameBounds.width < frameBounds.width
                 || maximizedFrameBounds.height < frameBounds.height) {
             throw new RuntimeException("Maximized frame is smaller than non maximized");