EmbeddedFrameTest1.java revision 0
2362N/A * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2362N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A @summary REGRESSION: Popup menus dont respond to selections when extend outside Applet 0N/A @author oleg.sukhodolsky area=awt.grab 0N/A @library ../../regtesthelpers 0N/A @run main EmbeddedFrameTest1 0N/A * summary: REGRESSION: Popup menus dont respond to selections when extend outside Applet 0N/A //*** Create instructions for the user here *** 0N/A "This is an AUTOMATIC test, simply wait until it is done.",
0N/A "The result (passed or failed) will be shown in the",
0N/A "message window below." 0N/A /***************************************************** 0N/A * Standard Test Machinery Section 0N/A * DO NOT modify anything in this section -- it's a 0N/A * standard chunk of code which has all of the 0N/A * synchronisation necessary for the test harness. 0N/A * By keeping it the same in all tests, it is easier 0N/A * to read and understand someone else's test, as 0N/A * well as insuring that all tests behave correctly 0N/A * with the test harness. 0N/A * There is a section following this for test- 0N/A ******************************************************/ // Not sure about what happens if multiple of this test are // instantiated in the same VM. Being static (and using // static vars), it aint gonna work. Not worrying about //The test passed, so just return from main and harness will // interepret this return as a pass //At this point, neither test pass nor test fail has been // called -- either would have thrown an exception and ended the // test, so we know we have multiple threads. //Test involves other threads, so sleep and wait for them to // called pass() or fail() //Timed out, so fail the test //The test harness may have interrupted the test. If so, rethrow the exception // so that the harness gets it and deals with it. //reset flag in case hit this code more than once for some reason (just safety) public static synchronized void pass()
//first check if this is executing in main thread //Still in the main thread, so set the flag just for kicks, // and throw a test passed exception which will be caught public static synchronized void fail()
//test writer didn't specify why test failed, so give generic fail(
"it just plain failed! :-)" );
//check if this called from main thread //If main thread, fail now 'cause not sleeping }
// class EmbeddedFrameTest1//This exception is used to exit from any level of call nesting // when it's determined that the test has passed, and immediately //*********** End Standard Test Machinery Section ********** /**************************************************** DO NOT modify anything below -- it's a standard chunk of code whose purpose is to make user interaction uniform, and thereby make it simpler to read and understand someone else's test. ****************************************************/ This is part of the standard test machinery. It creates a dialog (with the instructions), and is the interface for sending text messages to the user. To print the instructions, send an array of strings to Sysout.createDialog WithInstructions method. Put one line of instructions per array entry. To display a message for the tester to see, simply call Sysout.println with the string to be displayed. This mimics System.out.println but works within the test harness as well println(
"Any messages for the tester will display here." );
println(
"Any messages for the tester will display here." );
This is part of the standard test machinery. It provides a place for the test instructions to be displayed, and a place for interactive messages to the user to be displayed. To have the test instructions displayed, see Sysout. To have a message to the user be displayed, see Sysout. Do not call anything in this dialog directly. //DO NOT call this directly, go through Sysout //DO NOT call this directly, go through Sysout //Clear out any current instructions //Go down array of instruction strings //chop up each into pieces maxSringLength long //if longer than max then chop off first max chars to print //Try to chop on a word boundary //DO NOT call this directly, go through Sysout