< prev index next >

test/java/awt/EventQueue/PostEventOrderingTest/PostEventOrderingTest.java

Print this page


   1 /*
   2  * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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 /**
  25  * @test PostEventOrderingTest.java
  26  * @bug 4171596 6699589
  27  * @summary Checks that the posting of events between the PostEventQueue
  28  * @summary and the EventQueue maintains proper ordering.

  29  * @run main PostEventOrderingTest
  30  * @author fredx
  31  */
  32 
  33 import java.awt.*;
  34 import java.awt.event.*;
  35 import sun.awt.AppContext;
  36 import sun.awt.SunToolkit;
  37 
  38 public class PostEventOrderingTest {
  39     static boolean testPassed = true;
  40 
  41     public static void main(String[] args) throws Throwable {
  42         EventQueue q = Toolkit.getDefaultToolkit().getSystemEventQueue();
  43         for (int i = 0; i < 100; i++) {
  44             for (int j = 0; j < 100; j++) {
  45                 q.postEvent(new PostActionEvent());
  46                 for (int k = 0; k < 10; k++) {
  47                     SunToolkit.postEvent(AppContext.getAppContext(), new PostActionEvent());
  48                 }


   1 /*
   2  * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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 /**
  25  * @test PostEventOrderingTest.java
  26  * @bug 4171596 6699589
  27  * @summary Checks that the posting of events between the PostEventQueue
  28  * @summary and the EventQueue maintains proper ordering.
  29  * @modules java.desktop/sun.awt
  30  * @run main PostEventOrderingTest
  31  * @author fredx
  32  */
  33 
  34 import java.awt.*;
  35 import java.awt.event.*;
  36 import sun.awt.AppContext;
  37 import sun.awt.SunToolkit;
  38 
  39 public class PostEventOrderingTest {
  40     static boolean testPassed = true;
  41 
  42     public static void main(String[] args) throws Throwable {
  43         EventQueue q = Toolkit.getDefaultToolkit().getSystemEventQueue();
  44         for (int i = 0; i < 100; i++) {
  45             for (int j = 0; j < 100; j++) {
  46                 q.postEvent(new PostActionEvent());
  47                 for (int k = 0; k < 10; k++) {
  48                     SunToolkit.postEvent(AppContext.getAppContext(), new PostActionEvent());
  49                 }


< prev index next >