jdk/test/java/awt/event/OtherEvents/UngrabID/UngrabID.java
author goetz
Tue, 14 Jun 2016 10:44:59 +0200
changeset 39056 d99e63b6d962
parent 31448 1066345d2a8a
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:
7153
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
     1
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 31448
diff changeset
     2
 * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
7153
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
     4
 *
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
21596
0e3a39f29dbc 8027696: Incorrect copyright header in the tests
serb
parents: 7153
diff changeset
     7
 * published by the Free Software Foundation.
7153
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
     8
 *
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    13
 * accompanied this code).
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    14
 *
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    18
 *
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    21
 * questions.
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    22
 */
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    23
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    24
/*
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    25
  @test
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 31448
diff changeset
    26
  @key headful
7153
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    27
  @bug 6960516
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    28
  @summary check if the ungrab event has the ID < AWTEvent.RESERVED_ID_MAX
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    29
  @author Andrei Dmitriev : area=awt.event
31448
1066345d2a8a 8076468: Add @modules to tests in jdk_desktop test group
yan
parents: 23010
diff changeset
    30
  @modules java.desktop/sun.awt
7153
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    31
  @run main UngrabID
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    32
*/
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    33
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    34
import java.awt.*;
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    35
import java.awt.event.*;
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    36
import javax.swing.*;
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    37
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    38
public class UngrabID {
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    39
    public static void main(String[] args){
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    40
        Frame f = new Frame("Dummy");
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    41
        sun.awt.UngrabEvent event = new sun.awt.UngrabEvent(f);
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    42
        if (event.getID() > AWTEvent.RESERVED_ID_MAX) {
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    43
                System.out.println( " Event ID : "+event.getID() + " " + event.toString());
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    44
                throw new RuntimeException(" Ungrab Event ID should be less than AWTEvent.RESERVED_ID_MAX ("+AWTEvent.RESERVED_ID_MAX+"). Actual value : "+event.getID() + " Event:" + event.toString());
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    45
        }
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    46
        System.out.println("Test passed. ");
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    47
   }
87a8ead335f8 6960516: sun.awt.UngrabEvent has an ID over AWTEvent.RESERVED_ID_MAX
dav
parents:
diff changeset
    48
}