< prev index next >

test/javax/swing/JComboBox/ConsumedKeyTest/ConsumedKeyTest.java

Print this page
rev 14031 : 8160974: [TESTBUG] Mark more headful tests with @key headful.

This is a backport of fe58d505fffd from jdk9. 228/596 hunks apply without
modifications. 16 hunks required manual rework. The remainder were for files
not present in jdk8u.


  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import javax.swing.*;
  25 import java.awt.event.ActionEvent;
  26 import java.awt.event.KeyEvent;
  27 import java.awt.Toolkit;
  28 import java.awt.Robot;
  29 import sun.awt.SunToolkit;
  30 
  31 /*
  32   @test

  33   @bug 8031485 8058193
  34   @summary Combo box consuming escape and enter key events
  35   @author Petr Pchelko
  36   @run main ConsumedKeyTest
  37 */
  38 public class ConsumedKeyTest {
  39     private static volatile JFrame frame;
  40     private static volatile boolean passed;
  41 
  42     public static void main(String... args) throws Exception {
  43         test(KeyEvent.VK_ESCAPE);
  44         test(KeyEvent.VK_ENTER);
  45     }
  46 
  47     private static void test(final int key) throws Exception {
  48         passed = false;
  49         try {
  50             SwingUtilities.invokeAndWait(() -> {
  51                 frame = new JFrame();
  52                 JComboBox<String> combo = new JComboBox<>(new String[]{"one", "two", "three"});




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import javax.swing.*;
  25 import java.awt.event.ActionEvent;
  26 import java.awt.event.KeyEvent;
  27 import java.awt.Toolkit;
  28 import java.awt.Robot;
  29 import sun.awt.SunToolkit;
  30 
  31 /*
  32   @test
  33   @key headful
  34   @bug 8031485 8058193
  35   @summary Combo box consuming escape and enter key events
  36   @author Petr Pchelko
  37   @run main ConsumedKeyTest
  38 */
  39 public class ConsumedKeyTest {
  40     private static volatile JFrame frame;
  41     private static volatile boolean passed;
  42 
  43     public static void main(String... args) throws Exception {
  44         test(KeyEvent.VK_ESCAPE);
  45         test(KeyEvent.VK_ENTER);
  46     }
  47 
  48     private static void test(final int key) throws Exception {
  49         passed = false;
  50         try {
  51             SwingUtilities.invokeAndWait(() -> {
  52                 frame = new JFrame();
  53                 JComboBox<String> combo = new JComboBox<>(new String[]{"one", "two", "three"});


< prev index next >