test/jdk/java/awt/Modal/OnTop/OnTopDDFTest.java
author jboes
Fri, 08 Nov 2019 11:15:16 +0000
changeset 59029 3786a0962570
parent 51840 dc15e45122b2
permissions -rw-r--r--
8232853: AuthenticationFilter.Cache::remove may throw ConcurrentModificationException Summary: Change implementation to use iterator instead of plain LinkedList Reviewed-by: dfuchs, vtewari
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26025
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
     1
/*
51840
dc15e45122b2 8210894: remove jdk/testlibrary/Asserts
iignatyev
parents: 47216
diff changeset
     2
 * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
26025
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
     4
 *
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
     7
 * published by the Free Software Foundation.
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
     8
 *
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    13
 * accompanied this code).
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    14
 *
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    18
 *
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    21
 * questions.
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    22
 */
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    23
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    24
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    25
import java.awt.*;
51840
dc15e45122b2 8210894: remove jdk/testlibrary/Asserts
iignatyev
parents: 47216
diff changeset
    26
import static jdk.test.lib.Asserts.*;
26025
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    27
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    28
// DDF: Dialog - Dialog - Frame
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    29
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    30
public class OnTopDDFTest {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    31
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    32
    private volatile TestDialog dialog, leftDialog;
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    33
    private volatile TestFrame rightFrame;
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    34
    private volatile Frame hiddenFrame;
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    35
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    36
    private static final int delay = 500;
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    37
    private final ExtendedRobot robot;
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    38
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    39
    boolean setModal;
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    40
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    41
    Dialog.ModalityType modalityType;
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    42
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    43
    private OnTopDDFTest(Dialog.ModalityType modType,
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    44
                         boolean             modal) throws Exception {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    45
        modalityType = modType;
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    46
        setModal = modal;
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    47
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    48
        robot = new ExtendedRobot();
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    49
        EventQueue.invokeLater(this::createGUI);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    50
    }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    51
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    52
    public OnTopDDFTest(Dialog.ModalityType modalityType) throws Exception {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    53
        this(modalityType, false);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    54
    }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    55
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    56
    public OnTopDDFTest() throws Exception {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    57
        this(null, true);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    58
    }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    59
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    60
    private void createGUI() {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    61
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    62
        hiddenFrame = new Frame();
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    63
        leftDialog = new TestDialog(hiddenFrame);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    64
        leftDialog.setSize(200, 100);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    65
        leftDialog.setLocation(50, 50);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    66
        leftDialog.setVisible(true);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    67
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    68
        dialog = new CustomDialog(leftDialog);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    69
        if (setModal) {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    70
            dialog.setModal(true);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    71
            modalityType = dialog.getModalityType();
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    72
        } else if (modalityType != null) {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    73
            dialog.setModalityType(modalityType);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    74
        }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    75
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    76
        dialog.setSize(200, 100);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    77
        dialog.setLocation(200, 50);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    78
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    79
        rightFrame = new TestFrame();
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    80
        rightFrame.setSize(200, 100);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    81
        rightFrame.setLocation(350, 50);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    82
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    83
        dialog.setVisible(true);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    84
    }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    85
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    86
    public void doTest() throws Exception {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    87
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    88
        try {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    89
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    90
            robot.waitForIdle(delay);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    91
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    92
            dialog.activated.waitForFlagTriggered();
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    93
            assertTrue(dialog.activated.flag(), "Dialog still not visible.");
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    94
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    95
            dialog.clickOpenButton(robot);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    96
            robot.waitForIdle(delay);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    97
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    98
            if ((modalityType == Dialog.ModalityType.MODELESS) ||
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
    99
                (modalityType == Dialog.ModalityType.DOCUMENT_MODAL)) {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   100
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   101
                rightFrame.clickCloseButton(robot);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   102
                robot.waitForIdle(delay);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   103
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   104
                rightFrame.closeClicked.reset();
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   105
                dialog.transferFocusToDialog(robot, "A Frame partially hides the " +
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   106
                    modalityType + " Dialog.", dialog.openButton);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   107
                robot.waitForIdle(delay);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   108
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   109
                dialog.checkUnblockedDialog(robot,
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   110
                    "This is " + modalityType + " dialog and no other Dialogs blocks it.");
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   111
                robot.waitForIdle(delay);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   112
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   113
                rightFrame.closeClicked.waitForFlagTriggered(5);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   114
                assertFalse(rightFrame.closeClicked.flag(), "Clicking on " + modalityType +
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   115
                    "dialog did not bring it to the top. A frame on top of Dialog.");
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   116
                robot.waitForIdle(delay);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   117
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   118
                dialog.closeClicked.reset();
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   119
                if (modalityType == Dialog.ModalityType.MODELESS) {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   120
                    leftDialog.transferFocusToDialog(robot, "This dialog is not " +
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   121
                        "blocked by any other dialogs.", leftDialog.closeButton);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   122
                } else {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   123
                    leftDialog.transferFocusToBlockedDialog(robot, "This dialog is not " +
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   124
                        "blocked by any other dialogs.", leftDialog.closeButton);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   125
                }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   126
            } else {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   127
                dialog.checkUnblockedDialog(robot, "Checking if modal dialog " +
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   128
                    "appears on top of blocked Frame.");
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   129
                robot.waitForIdle(delay);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   130
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   131
                rightFrame.closeClicked.waitForFlagTriggered(5);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   132
                assertFalse(rightFrame.closeClicked.flag(),
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   133
                    "Frame on top of an application modal Dialog.");
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   134
                robot.waitForIdle(delay);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   135
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   136
                leftDialog.transferFocusToBlockedDialog(robot,
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   137
                    "An application modal dialog blocks the Dialog.", leftDialog.closeButton);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   138
            }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   139
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   140
            robot.waitForIdle(delay);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   141
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   142
            dialog.clickCloseButton(robot);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   143
            robot.waitForIdle(delay);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   144
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   145
        } finally {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   146
            EventQueue.invokeAndWait(this::closeAll);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   147
        }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   148
    }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   149
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   150
    private void closeAll() {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   151
        if (dialog != null) { dialog.dispose(); }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   152
        if (leftDialog != null) { leftDialog.dispose(); }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   153
        if (rightFrame != null) { rightFrame.dispose(); }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   154
        if (hiddenFrame != null) { hiddenFrame.dispose(); }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   155
    }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   156
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   157
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   158
    class CustomDialog extends TestDialog {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   159
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   160
        public CustomDialog(Dialog d) { super(d); }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   161
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   162
        @Override
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   163
        public void doOpenAction() {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   164
            if (rightFrame != null) {
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   165
                rightFrame.setVisible(true);
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   166
            }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   167
        }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   168
    }
7b31d014cae6 8052012: move awt automated tests from AWT_Modality to OpenJDK repository - part 5
avstepan
parents:
diff changeset
   169
}