jdk/test/javax/swing/reliability/TaskZoomJFrameChangeState.java
author goetz
Tue, 09 Dec 2014 11:57:46 +0100
changeset 28187 fc19df82d6ee
parent 26017 4d9ac57cd697
child 40128 e635645d2a8a
permissions -rw-r--r--
8066964: ppc64: argument and return type profiling, fix problem with popframe Reviewed-by: roland, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26017
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
     1
/*
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
     2
 * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
     4
 *
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
     8
 *
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    13
 * accompanied this code).
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    14
 *
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    18
 *
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    21
 * questions.
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    22
 */
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    23
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    24
import javax.swing.*;
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    25
import java.awt.*;
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    26
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    27
/*
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    28
 * @test
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    29
 * @summary Construct a JFrame, zoom it from the normal state and back forth
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    30
 *          using Frame.ZOOMED and Frame.NORMAL. Iconofy from the zoomed
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    31
 *          state and back forth using Frame.ICONIFIED and Frame.NORMAL and
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    32
 *          check the zoomed size is same as the screen size. Check the
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    33
 *          location of the jframe after restoration from zoom or icon.
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    34
 * @author Aruna Samji
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    35
 * @library ../../../lib/testlibrary
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    36
 * @build ExtendedRobot
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    37
 * @run main TaskZoomJFrameChangeState
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    38
 */
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    39
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    40
public class TaskZoomJFrameChangeState extends Task<GUIZoomFrame> {
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    41
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    42
    public static void main (String[] args) throws Exception {
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    43
        new TaskZoomJFrameChangeState(GUIZoomFrame.class, new ExtendedRobot()).task();
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    44
    }
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    45
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    46
    TaskZoomJFrameChangeState(Class guiClass, ExtendedRobot robot) throws Exception {
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    47
         super(guiClass, robot);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    48
    }
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    49
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    50
    public void task() throws Exception {
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    51
        SwingUtilities.invokeAndWait(() -> {
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    52
            gui.jframe1.setVisible(true);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    53
            gui.jframe1.getContentPane().removeAll();
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    54
            if (gui.jframe1.getExtendedState() != Frame.NORMAL)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    55
                gui.jframe1.setExtendedState(Frame.NORMAL);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    56
        });
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    57
        robot.waitForIdle(1000);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    58
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    59
        Point frameOrigin = gui.jframe1.getLocationOnScreen();
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    60
        SwingUtilities.invokeAndWait(() ->
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    61
            gui.jframe1.setExtendedState(Frame.ICONIFIED)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    62
        );
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    63
        robot.waitForIdle(1000);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    64
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    65
        //To check whether the bitwise mask for ICONIFIED state is set
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    66
        if (gui.jframe1.getExtendedState() != Frame.ICONIFIED)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    67
            throw new RuntimeException("The bitwise mask Frame.ICONIFIED is " +
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    68
                    "not set when the frame is in ICONIFIED state");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    69
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    70
        //To check whether the Frame is iconified programmatically
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    71
        if (!gui.iconify)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    72
            throw new RuntimeException("Frame is not Iconified");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    73
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    74
        //Normalising the Frame.
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    75
        SwingUtilities.invokeAndWait(() ->
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    76
            gui.jframe1.setExtendedState(Frame.NORMAL)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    77
        );
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    78
        robot.waitForIdle(1000);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    79
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    80
        //To check whether the bitwise mask for NORMAL state is set
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    81
        if (gui.jframe1.getExtendedState() != Frame.NORMAL)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    82
            throw new RuntimeException("The bitwise mask Frame.NORMAL is " +
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    83
                    "not set when the frame is in NORMAL state");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    84
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    85
        //To check whether the Frame is normalised programmatically
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    86
        if (!gui.normal)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    87
            throw new RuntimeException("Frame is not restored to normal");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    88
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    89
        Point newposition = gui.jframe1.getLocationOnScreen();
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    90
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    91
        if ((frameOrigin.x != newposition.x) & (frameOrigin.y != newposition.y))
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    92
            throw new RuntimeException("The frame is not positioned back to " +
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    93
                    "the original place  on the screen after iconified");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    94
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    95
        robot.waitForIdle(1000);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    96
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    97
        //To check whether the state is supported in the platform
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    98
        if (Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_HORIZ)) {
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
    99
            //Maximising the Frame horizontally
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   100
            SwingUtilities.invokeAndWait(() ->
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   101
                gui.jframe1.setExtendedState(Frame.MAXIMIZED_HORIZ)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   102
            );
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   103
            robot.waitForIdle(1000);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   104
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   105
            //To check whether the bitwise mask for MAXIMIZED_HORIZ state is set
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   106
            if (gui.jframe1.getExtendedState() != Frame.MAXIMIZED_HORIZ)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   107
                throw new RuntimeException("The bitwise mask Frame.MAXIMIZED_HOR " +
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   108
                        "is not set when the frame is in MAXIMIZED_HOR state");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   109
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   110
            //To check whether the Frame is maximized horizontally
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   111
            if (!gui.maxHor)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   112
                throw new RuntimeException("Frame is not maximized horizontally");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   113
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   114
            SwingUtilities.invokeAndWait(() ->
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   115
                gui.jframe1.setExtendedState(Frame.NORMAL)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   116
            );
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   117
            robot.waitForIdle(1000);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   118
        }
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   119
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   120
        //To check whether the state is supported in the platform
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   121
        if (Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_VERT)) {
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   122
            //Maximising the Frame vertically
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   123
            SwingUtilities.invokeAndWait(() ->
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   124
                gui.jframe1.setExtendedState(Frame.MAXIMIZED_VERT)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   125
            );
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   126
            robot.waitForIdle(1000);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   127
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   128
            //To check whether the bitwise mask for MAXIMIZED_VERT state is set
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   129
            if (gui.jframe1.getExtendedState() != Frame.MAXIMIZED_VERT)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   130
                throw new RuntimeException("The bitwise mask Frame.MAXIMIZED_VERT " +
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   131
                        "is not set when the frame is in MAXIMIZED_VERT state");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   132
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   133
            //To check whether the Frame is maximized vertically
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   134
            if (!gui.maxVer)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   135
                throw new RuntimeException("Frame is not maximized vertically");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   136
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   137
            SwingUtilities.invokeAndWait(() ->
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   138
                gui.jframe1.setExtendedState(Frame.NORMAL)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   139
            );
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   140
            robot.waitForIdle(1000);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   141
        }
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   142
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   143
        if (Toolkit.getDefaultToolkit().isFrameStateSupported
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   144
                (Frame.MAXIMIZED_BOTH)){
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   145
            //Maximising the Frame fully
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   146
            SwingUtilities.invokeAndWait(() ->
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   147
                gui.jframe1.setExtendedState(Frame.MAXIMIZED_BOTH)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   148
            );
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   149
        }
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   150
        robot.waitForIdle(1000);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   151
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   152
        //To check whether the state is supported in the platform
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   153
        if (Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) {
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   154
            //To check whether the bitwise mask for MAXIMIZED_BOTH state is set
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   155
            if (gui.jframe1.getExtendedState() != Frame.MAXIMIZED_BOTH)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   156
                throw new RuntimeException("The bitwise mask Frame.MAXIMIZED_BOTH " +
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   157
                        "is not set when the frame is in MAXIMIZED_BOTH state");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   158
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   159
            //To check whether the Frame is maximized fully
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   160
            if (!gui.maxBoth)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   161
                throw new RuntimeException("Frame is not maximized fully");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   162
        }
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   163
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   164
        //Normalising the Frame
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   165
        SwingUtilities.invokeAndWait(() ->
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   166
            gui.jframe1.setExtendedState(Frame.NORMAL)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   167
        );
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   168
        robot.waitForIdle(1000);
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   169
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   170
        //To check whether the bitwise mask for NORMAL state is set
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   171
        if (gui.jframe1.getExtendedState() != Frame.NORMAL)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   172
            throw new RuntimeException("The bitwise mask Frame.NORMAL is not " +
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   173
                    "set when the frame is in NORMAL state after Zoomed");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   174
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   175
        //To check whether the Frame is normalised programmatically
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   176
        if (!gui.normal)
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   177
            throw new RuntimeException("Frame is not restored to normal after Zoomed");
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   178
    }
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   179
}
4d9ac57cd697 8052408: Move AWT_BAT functional tests to OpenJDK (3 of 3)
dermashov
parents:
diff changeset
   180