jdk/test/java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java
author yan
Fri, 05 Dec 2014 14:55:08 +0300
changeset 28087 622b2f420bc3
parent 12535 6d2ee83614e8
child 40128 e635645d2a8a
permissions -rw-r--r--
8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2 Reviewed-by: serb, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
     1
/*
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
     2
 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
     4
 *
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
     8
 *
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    13
 * accompanied this code).
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    14
 *
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    18
 *
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    21
 * questions.
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    22
 */
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    23
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    24
/*
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    25
 * @test
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    26
 * @bug 7154048
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    27
 * @summary Programmatically resized  window does not receive mouse entered/exited events
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    28
 * @author  alexandr.scherbatiy area=awt.event
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    29
 * @run main ResizingFrameTest
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    30
 */
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    31
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    32
import java.awt.*;
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    33
import java.awt.event.*;
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    34
import javax.swing.*;
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    35
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    36
public class ResizingFrameTest {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    37
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    38
    private static volatile int mouseEnteredCount = 0;
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    39
    private static volatile int mouseExitedCount = 0;
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    40
    private static JFrame frame;
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    41
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    42
    public static void main(String[] args) throws Exception {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    43
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    44
        Robot robot = new Robot();
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    45
        robot.setAutoDelay(50);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    46
        robot.mouseMove(100, 100);
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
    47
        robot.delay(200);
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    48
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    49
        // create a frame under the mouse cursor
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    50
        SwingUtilities.invokeAndWait(new Runnable() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    51
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    52
            @Override
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    53
            public void run() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    54
                createAndShowGUI();
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    55
            }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    56
        });
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    57
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    58
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
    59
        robot.waitForIdle();
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
    60
        robot.delay(1000);
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    61
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    62
        if (mouseEnteredCount != 1 || mouseExitedCount != 0) {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    63
            throw new RuntimeException("No Mouse Entered/Exited events!");
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    64
        }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    65
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    66
        // iconify frame
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    67
        SwingUtilities.invokeAndWait(new Runnable() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    68
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    69
            @Override
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    70
            public void run() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    71
                frame.setExtendedState(Frame.ICONIFIED);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    72
            }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    73
        });
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    74
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
    75
        robot.waitForIdle();
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
    76
        robot.delay(1000);
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    77
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    78
        if (mouseEnteredCount != 1 || mouseExitedCount != 1) {
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
    79
            throw new RuntimeException("No Mouse Entered/Exited events! "+mouseEnteredCount+", "+mouseExitedCount);
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    80
        }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    81
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    82
        // deiconify frame
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    83
        SwingUtilities.invokeAndWait(new Runnable() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    84
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    85
            @Override
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    86
            public void run() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    87
                frame.setExtendedState(Frame.NORMAL);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    88
            }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    89
        });
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    90
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
    91
        robot.waitForIdle();
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
    92
        robot.delay(1000);
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    93
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    94
        if (mouseEnteredCount != 2 || mouseExitedCount != 1) {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    95
            throw new RuntimeException("No Mouse Entered/Exited events!");
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    96
        }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    97
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    98
        // move the mouse out of the frame
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
    99
        robot.mouseMove(500, 500);
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   100
        robot.waitForIdle();
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   101
        robot.delay(1000);
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   102
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   103
        if (mouseEnteredCount != 2 || mouseExitedCount != 2) {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   104
            throw new RuntimeException("No Mouse Entered/Exited events!");
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   105
        }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   106
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   107
        // maximize the frame
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   108
        SwingUtilities.invokeAndWait(new Runnable() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   109
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   110
            @Override
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   111
            public void run() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   112
                frame.setExtendedState(Frame.MAXIMIZED_BOTH);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   113
            }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   114
        });
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   115
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   116
        robot.waitForIdle();
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   117
        robot.delay(1000);
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   118
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   119
        if (mouseEnteredCount != 3 || mouseExitedCount != 2) {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   120
            throw new RuntimeException("No Mouse Entered/Exited events!");
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   121
        }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   122
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   123
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   124
        // demaximize the frame
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   125
        SwingUtilities.invokeAndWait(new Runnable() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   126
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   127
            @Override
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   128
            public void run() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   129
                frame.setExtendedState(Frame.NORMAL);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   130
            }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   131
        });
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   132
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   133
        robot.waitForIdle();
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   134
        robot.delay(1000);
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   135
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   136
        if (mouseEnteredCount != 3 || mouseExitedCount != 3) {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   137
            throw new RuntimeException("No Mouse Entered/Exited events!");
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   138
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   139
        }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   140
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   141
        // move the frame under the mouse
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   142
        SwingUtilities.invokeAndWait(new Runnable() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   143
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   144
            @Override
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   145
            public void run() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   146
                frame.setLocation(400, 400);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   147
            }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   148
        });
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   149
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   150
        robot.waitForIdle();
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   151
        robot.delay(1000);
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   152
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   153
        if (mouseEnteredCount != 4 || mouseExitedCount != 3) {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   154
            throw new RuntimeException("No Mouse Entered/Exited events!");
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   155
        }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   156
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   157
        // move the frame out of the mouse
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   158
        SwingUtilities.invokeAndWait(new Runnable() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   159
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   160
            @Override
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   161
            public void run() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   162
                frame.setLocation(100, 100);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   163
            }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   164
        });
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   165
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   166
        robot.waitForIdle();
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   167
        robot.delay(400);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   168
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   169
        if (mouseEnteredCount != 4 || mouseExitedCount != 4) {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   170
            throw new RuntimeException("No Mouse Entered/Exited events!");
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   171
        }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   172
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   173
        // enlarge the frame bounds
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   174
        SwingUtilities.invokeAndWait(new Runnable() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   175
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   176
            @Override
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   177
            public void run() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   178
                frame.setBounds(100, 100, 800, 800);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   179
            }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   180
        });
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   181
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   182
        robot.waitForIdle();
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   183
        robot.delay(200);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   184
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   185
        if (mouseEnteredCount != 5 || mouseExitedCount != 4) {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   186
            throw new RuntimeException("No Mouse Entered/Exited events!");
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   187
        }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   188
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   189
        // make the frame bounds smaller
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   190
        SwingUtilities.invokeAndWait(new Runnable() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   191
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   192
            @Override
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   193
            public void run() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   194
                frame.setBounds(100, 100, 200, 300);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   195
            }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   196
        });
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   197
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   198
        robot.waitForIdle();
12535
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   199
        robot.delay(400);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   200
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   201
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   202
        if (mouseEnteredCount != 5 || mouseExitedCount != 5) {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   203
            throw new RuntimeException("No Mouse Entered/Exited events!");
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   204
        }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   205
    }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   206
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   207
    private static void createAndShowGUI() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   208
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   209
        frame = new JFrame("Main Frame");
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   210
        frame.setSize(300, 200);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   211
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   212
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   213
        frame.addMouseListener(new MouseAdapter() {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   214
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   215
            @Override
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   216
            public void mouseEntered(MouseEvent e) {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   217
                mouseEnteredCount++;
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   218
            }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   219
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   220
            @Override
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   221
            public void mouseExited(MouseEvent e) {
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   222
                mouseExitedCount++;
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   223
            }
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   224
        });
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   225
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   226
        frame.setVisible(true);
6d2ee83614e8 7154048: [macosx] At least drag twice, the toolbar can be dragged to the left side
alexsch
parents:
diff changeset
   227
    }
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 12535
diff changeset
   228
}