jdk/test/java/awt/Robot/CtorTest/CtorTest.java
author goetz
Tue, 14 Jun 2016 10:44:59 +0200
changeset 39056 d99e63b6d962
parent 28087 622b2f420bc3
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:
3232
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
     1
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 28087
diff changeset
     2
 * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
3232
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
     4
 *
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
     8
 *
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    13
 * accompanied this code).
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    14
 *
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3232
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3232
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3232
diff changeset
    21
 * questions.
3232
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    22
 */
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    23
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    24
/*
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    25
  @test
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 28087
diff changeset
    26
  @key headful
3232
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    27
  @bug 6855323
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    28
  @summary  Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    29
  @author Dmitry Cherepanov area=awt.robot
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    30
  @run main CtorTest
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    31
*/
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    32
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    33
/**
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    34
 * CtorRobot.java
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    35
 *
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    36
 * summary: creates Robot using one parameter constructor
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    37
 */
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    38
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    39
import java.awt.*;
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    40
import java.awt.event.*;
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    41
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    42
public class CtorTest
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    43
{
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    44
    public static void main(String []s) throws Exception
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    45
    {
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    46
        // one parameter constructor
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    47
        GraphicsDevice graphicsDevice = GraphicsEnvironment.
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    48
            getLocalGraphicsEnvironment().getDefaultScreenDevice();
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    49
        Robot robot = new Robot(graphicsDevice);
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    50
        clickOnFrame(robot);
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    51
    }
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    52
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    53
    // generate mouse events
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    54
    private static void clickOnFrame(Robot robot) {
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    55
        Frame frame = new Frame();
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    56
        frame.setBounds(100, 100, 100, 100);
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    57
        frame.setVisible(true);
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    58
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 5506
diff changeset
    59
        robot.waitForIdle();
3232
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    60
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    61
        // click in the middle of the frame
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    62
        robot.mouseMove(150, 150);
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    63
        robot.delay(50);
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    64
        robot.mousePress(InputEvent.BUTTON1_MASK);
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    65
        robot.delay(50);
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    66
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    67
28087
622b2f420bc3 8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents: 5506
diff changeset
    68
        robot.waitForIdle();
3232
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    69
    }
aacdc74b37d2 6855323: Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
dcherepanov
parents:
diff changeset
    70
}