jdk/test/java/awt/Window/LocationByPlatform/LocationByPlatformTest.java
author goetz
Tue, 14 Jun 2016 10:44:59 +0200
changeset 39056 d99e63b6d962
parent 20454 d332fc10731f
permissions -rw-r--r--
8159690: [TESTBUG] Mark headful tests with @key headful. Reviewed-by: simonis, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20454
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
     1
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 20454
diff changeset
     2
 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
20454
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
     4
 *
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
     8
 *
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    13
 * accompanied this code).
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    14
 *
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    18
 *
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    21
 * questions.
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    22
 */
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    23
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    24
/**
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    25
 * @test
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 20454
diff changeset
    26
 * @key headful
20454
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    27
 * @bug 7092283
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    28
 * @author Alexander Scherbatiy
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    29
 * @summary Property Window.locationByPlatform is not cleared by calling
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    30
 *          setVisible(false)
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    31
 * @run main LocationByPlatformTest
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    32
 */
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    33
import java.awt.Window;
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    34
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    35
public class LocationByPlatformTest {
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    36
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    37
    public static void main(String[] args) {
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    38
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    39
        Window window = new Window(null);
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    40
        window.setSize(100, 100);
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    41
        window.setLocationByPlatform(true);
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    42
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    43
        if (!window.isLocationByPlatform()) {
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    44
            throw new RuntimeException("Location by platform is not set");
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    45
        }
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    46
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    47
        window.setLocation(10, 10);
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    48
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    49
        if (window.isLocationByPlatform()) {
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    50
            throw new RuntimeException("Location by platform is not cleared");
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    51
        }
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    52
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    53
        window.setLocationByPlatform(true);
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    54
        window.setBounds(20, 20, 50, 50);
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    55
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    56
        if (window.isLocationByPlatform()) {
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    57
            throw new RuntimeException("Location by platform is not cleared");
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    58
        }
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    59
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    60
        window.setLocationByPlatform(true);
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    61
        window.setVisible(false);
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    62
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    63
        if (window.isLocationByPlatform()) {
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    64
            throw new RuntimeException("Location by platform is not cleared");
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    65
        }
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    66
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    67
        window.setLocationByPlatform(true);
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    68
        window.setVisible(true);
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    69
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    70
        if (window.isLocationByPlatform()) {
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    71
            throw new RuntimeException("Location by platform is not cleared");
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    72
        }
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    73
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    74
        window.dispose();
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    75
    }
d332fc10731f 7092283: Property Window.locationByPlatform is not cleared by calling setVisible(false)
alexsch
parents:
diff changeset
    76
}