test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 21,42 **** * questions. */ /* @test ! @bug 7154072 @summary Tests that key events with modifiers are not swallowed. @author anton.tarasov: area=awt.focus @library ../../../regtesthelpers @build Util @run main SwallowKeyEvents */ ! import java.awt.AWTException; ! import java.awt.Frame; ! import java.awt.Robot; ! import java.awt.TextField; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import test.java.awt.regtesthelpers.Util; public class SwallowKeyEvents { --- 21,39 ---- * questions. */ /* @test ! @bug 7154072 7161320 @summary Tests that key events with modifiers are not swallowed. @author anton.tarasov: area=awt.focus @library ../../../regtesthelpers @build Util @run main SwallowKeyEvents */ ! import java.awt.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import test.java.awt.regtesthelpers.Util; public class SwallowKeyEvents {
*** 47,56 **** --- 44,59 ---- static Frame f = new Frame("Frame"); static TextField t = new TextField("text"); static Robot r; public static void main(String[] args) { + + if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) { + System.err.println("Skipped. Test for OS X only."); + return; + } + f.add(t); f.pack(); f.setVisible(true); t.requestFocus();