jdk/test/java/awt/Modal/ToBack/ToBackFDFTest.java
author avstepan
Wed, 19 Nov 2014 14:12:59 +0400
changeset 28069 907a72cb0feb
permissions -rw-r--r--
8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6 Reviewed-by: pchelko
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28069
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
     1
/*
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
     2
 * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
     4
 *
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
     7
 * published by the Free Software Foundation.
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
     8
 *
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    13
 * accompanied this code).
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    14
 *
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    18
 *
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    21
 * questions.
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    22
 */
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    23
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    24
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    25
import java.awt.*;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    26
import static jdk.testlibrary.Asserts.*;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    27
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    28
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    29
// FDF: Frame->Dialog->Frame
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    30
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    31
public class ToBackFDFTest {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    32
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    33
    private volatile CustomDialog dialog;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    34
    private volatile TestFrame leftFrame, rightFrame;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    35
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    36
    private static final int delay = 500;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    37
    private final ExtendedRobot robot;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    38
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    39
    private Dialog hiddenDialog;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    40
    private Frame  hiddenFrame;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    41
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    42
    public enum DialogOwner {HIDDEN_DIALOG, NULL_DIALOG, HIDDEN_FRAME, NULL_FRAME, FRAME};
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    43
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    44
    private DialogOwner owner;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    45
    private volatile boolean setModal;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    46
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    47
    private Dialog.ModalityType modalityType;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    48
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    49
    private ToBackFDFTest(Dialog.ModalityType modType,
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    50
                          boolean             modal,
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    51
                          DialogOwner         o) throws Exception {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    52
        modalityType = modType;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    53
        setModal = modal;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    54
        owner = o;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    55
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    56
        robot = new ExtendedRobot();
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    57
        EventQueue.invokeLater(this::createGUI);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    58
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    59
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    60
    public ToBackFDFTest(Dialog.ModalityType modalityType,
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    61
                         DialogOwner         o) throws Exception {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    62
        this(modalityType, false, o);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    63
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    64
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    65
    public ToBackFDFTest(boolean modal, DialogOwner o) throws Exception {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    66
        this(null, modal, o);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    67
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    68
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    69
    private void createGUI() {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    70
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    71
        leftFrame = new TestFrame();
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    72
        leftFrame.setLocation(50, 50);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    73
        leftFrame.setBackground(Color.BLUE);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    74
        leftFrame.setVisible(true);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    75
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    76
        switch (owner) {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    77
            case HIDDEN_DIALOG:
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    78
                hiddenDialog = new Dialog((Frame) null);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    79
                dialog = new CustomDialog(hiddenDialog);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    80
                break;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    81
            case NULL_DIALOG:
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    82
                dialog = new CustomDialog((Dialog) null);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    83
                break;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    84
            case HIDDEN_FRAME:
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    85
                hiddenFrame = new Frame();
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    86
                dialog = new CustomDialog(hiddenFrame);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    87
                break;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    88
            case NULL_FRAME:
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    89
                dialog = new CustomDialog((Frame) null);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    90
                break;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    91
            case FRAME:
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    92
                dialog = new CustomDialog(leftFrame);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    93
                break;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    94
        }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    95
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    96
        if (modalityType == null) {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    97
            dialog.setModal(setModal);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    98
            modalityType = dialog.getModalityType();
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
    99
        } else if (modalityType != null) {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   100
            dialog.setModalityType(modalityType);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   101
        }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   102
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   103
        dialog.setBackground(Color.WHITE);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   104
        dialog.setLocation(150, 50);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   105
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   106
        rightFrame = new TestFrame();
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   107
        rightFrame.setLocation(250, 50);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   108
        rightFrame.setBackground(Color.RED);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   109
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   110
        if (modalityType == Dialog.ModalityType.APPLICATION_MODAL) {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   111
            rightFrame.setModalExclusionType(
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   112
                Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   113
        } else if (modalityType == Dialog.ModalityType.TOOLKIT_MODAL) {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   114
            rightFrame.setModalExclusionType(
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   115
                Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   116
        }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   117
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   118
        dialog.setVisible(true);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   119
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   120
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   121
    private void checkIfLeftOnTop(boolean refState, String msg) {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   122
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   123
        Point p = leftFrame.getLocationOnScreen();
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   124
        int x = p.x + (int)(leftFrame.getWidth()  * 0.9);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   125
        int y = p.y + (int)(leftFrame.getHeight() * 0.9);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   126
        boolean f = robot.getPixelColor(x, y).equals(leftFrame.getBackground());
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   127
        assertEQ(refState, f, msg);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   128
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   129
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   130
    private void checkIfRightOnTop(boolean refState, String msg) {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   131
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   132
        Point p = rightFrame.getLocationOnScreen();
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   133
        int x = p.x + (int)(rightFrame.getWidth()  * 0.1);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   134
        int y = p.y + (int)(rightFrame.getHeight() * 0.9);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   135
        boolean f = robot.getPixelColor(x, y).equals(rightFrame.getBackground());
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   136
        assertEQ(refState, f, msg);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   137
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   138
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   139
    private void Test() throws Exception {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   140
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   141
        String type =
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   142
            dialog.getModalityType().toString().toLowerCase().replace('_', ' ');
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   143
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   144
        final String msg1 = "The " + type + "dialog was " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   145
            "overlapped by the blocked frame.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   146
        EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg1); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   147
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   148
        EventQueue.invokeAndWait(() -> { leftFrame.toFront(); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   149
        robot.waitForIdle(delay);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   150
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   151
        final String msg2 = "The dialog is still overlapped by the right frame" +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   152
            " after calling toFront method for the blocked (left) frame.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   153
        EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg2); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   154
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   155
        final String msg3 = "The " + type + " dialog was overlapped by the " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   156
            "blocked frame after calling toFront method for the blocked frame.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   157
        EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg3); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   158
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   159
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   160
        if (owner == DialogOwner.FRAME) { return; }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   161
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   162
        EventQueue.invokeAndWait(() -> { leftFrame.toBack(); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   163
        robot.waitForIdle(delay);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   164
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   165
        final String msg4 = "Calling toBack " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   166
            "for the blocked frame pushed the blocking dialog to back.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   167
        EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg4); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   168
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   169
        final String msg5 = "The " + type + " dialog was overlapped " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   170
            "by the blocked frame after toBack was called for the left frame.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   171
        EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg5); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   172
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   173
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   174
    private void docTest() throws Exception {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   175
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   176
        if (owner == DialogOwner.FRAME) { Test(); }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   177
        else {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   178
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   179
            final String msg1 = "toBack was called for the dialog.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   180
            EventQueue.invokeAndWait(() -> {  checkIfLeftOnTop(true, msg1); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   181
            EventQueue.invokeAndWait(() -> { checkIfRightOnTop(true, msg1); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   182
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   183
            EventQueue.invokeAndWait(() -> { dialog.toFront(); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   184
            robot.waitForIdle(delay);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   185
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   186
            final String msg2 = "Dialog still behind " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   187
                "the right frame even after calling toFront method.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   188
            EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg2); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   189
            final String msg3 = "The document modal dialog " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   190
                "gone behind the blocked left frame.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   191
            EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg3); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   192
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   193
            EventQueue.invokeAndWait(() -> { leftFrame.toBack(); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   194
            robot.waitForIdle(delay);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   195
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   196
            final String msg4 = "Calling toBack for the left " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   197
                "frame pushed the document modal dialog to back.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   198
            EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg4); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   199
            final String msg5 = "The document modal dialog " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   200
                "was pushed behind the left frame when toBack called for the frame.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   201
            EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg5); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   202
        }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   203
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   204
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   205
    private void modelessTest() throws Exception {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   206
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   207
        if (owner == DialogOwner.FRAME) {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   208
            final String msg = "The modeless dialog was " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   209
                "pushed behind the parent left frame after toBack call.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   210
            EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   211
        } else {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   212
            final String msg =
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   213
                "Dialog should not overlap the frame after calling toBack.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   214
            EventQueue.invokeAndWait(() -> {  checkIfLeftOnTop(true, msg); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   215
            EventQueue.invokeAndWait(() -> { checkIfRightOnTop(true, msg); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   216
        }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   217
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   218
        EventQueue.invokeAndWait(() -> { dialog.toFront(); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   219
        robot.waitForIdle(delay);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   220
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   221
        final String msg1 = "The frames should not overlap the dialog " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   222
            "after calling toFront for it.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   223
        EventQueue.invokeAndWait(() -> {  checkIfLeftOnTop(false, msg1); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   224
        EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg1); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   225
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   226
        if (owner == DialogOwner.FRAME) { return; }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   227
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   228
        EventQueue.invokeAndWait(() -> { leftFrame.toBack(); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   229
        robot.waitForIdle(delay);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   230
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   231
        final String msg2 = "Calling toBack method for the " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   232
            "left frame pushed the modeless dialog to back.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   233
        EventQueue.invokeAndWait(() -> { checkIfRightOnTop(false, msg2); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   234
        final String msg3 = "The modeless dialog was pushed " +
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   235
            "behind the left frame after toBack was called for the frame.";
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   236
        EventQueue.invokeAndWait(() -> { checkIfLeftOnTop(false, msg3); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   237
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   238
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   239
    public void doTest() throws Exception {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   240
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   241
        try {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   242
            robot.waitForIdle(delay);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   243
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   244
            dialog.clickOpenButton(robot);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   245
            robot.waitForIdle(delay);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   246
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   247
            dialog.clickCloseButton(robot);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   248
            robot.waitForIdle(delay);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   249
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   250
            EventQueue.invokeAndWait(() -> { dialog.toBack(); });
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   251
            robot.waitForIdle(delay);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   252
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   253
            switch (modalityType) {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   254
                case APPLICATION_MODAL:
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   255
                case TOOLKIT_MODAL:
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   256
                    Test();
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   257
                    break;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   258
                case DOCUMENT_MODAL:
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   259
                    docTest();
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   260
                    break;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   261
                case MODELESS:
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   262
                    modelessTest();
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   263
                    break;
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   264
            }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   265
        } finally {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   266
            EventQueue.invokeAndWait(this::closeAll);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   267
        }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   268
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   269
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   270
    private void closeAll() {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   271
        if (dialog       != null) {       dialog.dispose(); }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   272
        if (leftFrame    != null) {    leftFrame.dispose(); }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   273
        if (rightFrame   != null) {   rightFrame.dispose(); }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   274
        if (hiddenDialog != null) { hiddenDialog.dispose(); }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   275
        if (hiddenFrame  != null) {  hiddenFrame.dispose(); }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   276
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   277
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   278
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   279
    class CustomDialog extends TestDialog {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   280
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   281
        public CustomDialog(Dialog d) { super(d); }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   282
        public CustomDialog(Frame  f) { super(f); }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   283
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   284
        @Override
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   285
        public void doOpenAction() {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   286
            if (rightFrame != null) {
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   287
                rightFrame.setVisible(true);
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   288
            }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   289
        }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   290
    }
907a72cb0feb 8054143: move awt automated tests from AWT_Modality to OpenJDK repository - part 6
avstepan
parents:
diff changeset
   291
}