1 /*
2 @test
3 @bug 4632143
4 @summary Unit test for the RFE window/frame/dialog always on top
5 @author dom@sparc.spb.su: area=awt.toplevel
6 @run main AutoTestOnTop
7 */
8
9 import java.awt.*;
10 import java.awt.event.*;
11 import java.lang.reflect.*;
12 import javax.swing.*;
13 import java.util.Vector;
14
15 /**
16 * @author tav@sparc.spb.su
17 * @author dom@sparc.spb.su
18 * Tests that always-on-top windows combine correctly with different kinds of window in different styles and conditions.
19 *
20 * !!! WARNING !!!
21 * The test fails sometimes because the toFront() method doesn't guarantee
638 " threw exeption " + e);
639 }
640 return result;
641 }
642
643 private static void waitTillShown(Component c) {
644 while (true) {
645 try {
646 Thread.sleep(100);
647 c.getLocationOnScreen();
648 break;
649 } catch (InterruptedException e) {
650 e.printStackTrace();
651 break;
652 }
653 }
654 }
655
656 private static void waitForIdle(boolean doCheck) {
657 try {
658 Toolkit.getDefaultToolkit().sync();
659 sun.awt.SunToolkit.flushPendingEvents();
660 EventQueue.invokeAndWait( new Runnable() {
661 public void run() {} // Dummy implementation
662 } );
663 } catch(InterruptedException ite) {
664 System.err.println("waitForIdle, non-fatal exception caught:");
665 ite.printStackTrace();
666 } catch(InvocationTargetException ine) {
667 System.err.println("waitForIdle, non-fatal exception caught:");
668 ine.printStackTrace();
669 }
670 doCheckEvents = doCheck;
671
672 if (doCheck) {
673 eventsCheckPassed = eventsCheckInitVals[actNum]; // Initialize
674 } else if (!eventsCheckPassed &&
675 msgEventsChecks[actNum] != null) {
676
677
678 // Some expected event hasn't been catched,
679 // so give it one more chance...
|
1 /*
2 * Copyright (c) 2003, 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
26 @bug 4632143
27 @summary Unit test for the RFE window/frame/dialog always on top
28 @author dom@sparc.spb.su: area=awt.toplevel
29 @run main AutoTestOnTop
30 */
31
32 import java.awt.*;
33 import java.awt.event.*;
34 import java.lang.reflect.*;
35 import javax.swing.*;
36 import java.util.Vector;
37
38 /**
39 * @author tav@sparc.spb.su
40 * @author dom@sparc.spb.su
41 * Tests that always-on-top windows combine correctly with different kinds of window in different styles and conditions.
42 *
43 * !!! WARNING !!!
44 * The test fails sometimes because the toFront() method doesn't guarantee
661 " threw exeption " + e);
662 }
663 return result;
664 }
665
666 private static void waitTillShown(Component c) {
667 while (true) {
668 try {
669 Thread.sleep(100);
670 c.getLocationOnScreen();
671 break;
672 } catch (InterruptedException e) {
673 e.printStackTrace();
674 break;
675 }
676 }
677 }
678
679 private static void waitForIdle(boolean doCheck) {
680 try {
681 robot.waitForIdle();
682 EventQueue.invokeAndWait( new Runnable() {
683 public void run() {} // Dummy implementation
684 } );
685 } catch(InterruptedException ite) {
686 System.err.println("waitForIdle, non-fatal exception caught:");
687 ite.printStackTrace();
688 } catch(InvocationTargetException ine) {
689 System.err.println("waitForIdle, non-fatal exception caught:");
690 ine.printStackTrace();
691 }
692 doCheckEvents = doCheck;
693
694 if (doCheck) {
695 eventsCheckPassed = eventsCheckInitVals[actNum]; // Initialize
696 } else if (!eventsCheckPassed &&
697 msgEventsChecks[actNum] != null) {
698
699
700 // Some expected event hasn't been catched,
701 // so give it one more chance...
|