< prev index next >

test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java

Print this page

        

*** 30,49 **** import java.awt.Toolkit; import java.awt.Robot; /** * @test ! * @bug 8007219 * @author Alexander Scherbatiy * @summary Frame size reverts meaning of maximized attribute * @run main MaximizedToMaximized */ public class MaximizedToMaximized { public static void main(String[] args) throws Exception { Frame frame = new Frame(); final Toolkit toolkit = Toolkit.getDefaultToolkit(); final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice(); --- 30,50 ---- import java.awt.Toolkit; import java.awt.Robot; /** * @test ! * @bug 8007219 8146168 * @author Alexander Scherbatiy * @summary Frame size reverts meaning of maximized attribute * @run main MaximizedToMaximized */ public class MaximizedToMaximized { public static void main(String[] args) throws Exception { Frame frame = new Frame(); + Robot robot = new Robot(); final Toolkit toolkit = Toolkit.getDefaultToolkit(); final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice();
*** 60,76 **** availableScreenBounds.height -= (screenInsets.top + screenInsets.bottom); frame.setBounds(availableScreenBounds.x, availableScreenBounds.y, availableScreenBounds.width, availableScreenBounds.height); frame.setVisible(true); Rectangle frameBounds = frame.getBounds(); frame.setExtendedState(Frame.MAXIMIZED_BOTH); - Robot robot = new Robot(); robot.waitForIdle(); Rectangle maximizedFrameBounds = frame.getBounds(); if (maximizedFrameBounds.width < frameBounds.width || maximizedFrameBounds.height < frameBounds.height) { throw new RuntimeException("Maximized frame is smaller than non maximized"); } } --- 61,79 ---- availableScreenBounds.height -= (screenInsets.top + screenInsets.bottom); 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.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"); } }
< prev index next >