jdk/test/java/awt/Frame/SlideNotResizableTest/SlideNotResizableTest.java
author yan
Mon, 10 Nov 2014 16:23:30 +0300
changeset 27763 1fba965925e8
parent 24134 46d80fad2e48
child 39056 d99e63b6d962
permissions -rw-r--r--
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1 Reviewed-by: pchelko, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24134
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
     1
/*
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
     4
 *
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
     7
 * published by the Free Software Foundation.
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
     8
 *
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    13
 * accompanied this code).
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    14
 *
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    18
 *
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    21
 * questions.
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    22
 */
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    23
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    24
import java.awt.*;
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    25
import java.awt.Dimension;
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    26
import java.awt.Point;
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    27
import java.awt.event.InputEvent;
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    28
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    29
/**
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    30
 * @test
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    31
 * @bug 8032595
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    32
 * @summary setResizable(false) makes a frame slide down
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    33
 * @author Petr Pchelko
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    34
 */
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    35
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    36
public class SlideNotResizableTest {
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    37
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    38
    private static volatile boolean passed = false;
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    39
    private static final Dimension FRAME_SIZE = new Dimension(100, 100);
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    40
    private static final Point FRAME_LOCATION = new Point(200, 200);
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    41
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    42
    public static void main(String[] args) throws Throwable {
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    43
        Frame aFrame = null;
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    44
        try {
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    45
            aFrame = new Frame();
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    46
            aFrame.setSize(FRAME_SIZE);
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    47
            aFrame.setLocation(FRAME_LOCATION);
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    48
            aFrame.setResizable(false);
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    49
            aFrame.setVisible(true);
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    50
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    51
            sync();
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    52
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    53
            if (!aFrame.getLocation().equals(FRAME_LOCATION)) {
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    54
                throw new RuntimeException("FAILED: Wrong frame position");
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    55
            }
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    56
        } finally {
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    57
            if (aFrame != null) {
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    58
                aFrame.dispose();
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    59
            }
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    60
        }
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    61
    }
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    62
27763
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24134
diff changeset
    63
    private static void sync() throws Exception {
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24134
diff changeset
    64
        Robot robot = new Robot();
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24134
diff changeset
    65
        robot.waitForIdle();
24134
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    66
        Thread.sleep(1000);
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    67
    }
46d80fad2e48 8032595: [macosx] setResizable(false) makes a frame slide down
pchelko
parents:
diff changeset
    68
}