2362N/A * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. 98N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 98N/A * This code is free software; you can redistribute it and/or modify it 98N/A * under the terms of the GNU General Public License version 2 only, as 98N/A * published by the Free Software Foundation. 98N/A * This code is distributed in the hope that it will be useful, but WITHOUT 98N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 98N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 98N/A * version 2 for more details (a copy is included in the LICENSE file that 98N/A * accompanied this code). 98N/A * You should have received a copy of the GNU General Public License version 98N/A * 2 along with this work; if not, write to the Free Software Foundation, 98N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 98N/A @test %W% %E% %I%, %G% 98N/A @summary support for high-resolution mouse wheel 98N/A @author dmitry cherepanov: area=awt.event 98N/A //*** test-writer defined static variables go here *** 98N/A "1. the test is for high-resolution mouse wheel only, ",
98N/A " refer to the cr# 6524352 for more info about such devices, ",
98N/A "2. you'll see a frame, the frame contains a checkbox, ",
98N/A "3. initially, the state of the checkbox is off, ",
98N/A " use mouse wheel over the frame, ",
98N/A " and the frame will change its size gradually, ",
98N/A "4. turn on the checkbox, ",
98N/A " use mouse wheel again over the frame, ",
98N/A " now the frame will change its size smoothly, ",
98N/A "5. if the frame has always the same size or",
98N/A " if the frame changes its size equally in 3,4 cases, ",
98N/A " then the test failed. Otherwise, it passed." 98N/A /***************************************************** 98N/A * Standard Test Machinery Section 98N/A * DO NOT modify anything in this section -- it's a 98N/A * standard chunk of code which has all of the 98N/A * synchronisation necessary for the test harness. 98N/A * By keeping it the same in all tests, it is easier 98N/A * to read and understand someone else's test, as 98N/A * well as insuring that all tests behave correctly 98N/A * with the test harness. 98N/A * There is a section following this for test-defined 98N/A ******************************************************/ 98N/A //The test passed, so just return from main and harness will 98N/A // interepret this return as a pass 98N/A //At this point, neither test passed nor test failed has been 98N/A // called -- either would have thrown an exception and ended the 98N/A // test, so we know we have multiple threads. 98N/A //Test involves other threads, so sleep and wait for them to 98N/A // called pass() or fail() 98N/A //Timed out, so fail the test 98N/A //reset flag in case hit this code more than once for some reason (just safety) 98N/A //first check if this is executing in main thread 98N/A //Still in the main thread, so set the flag just for kicks, 98N/A // and throw a test passed exception which will be caught 98N/A // and end the test. 98N/A //pass was called from a different thread, so set the flag and interrupt 98N/A //test writer didn't specify why test failed, so give generic 98N/A //check if this called from main thread 98N/A //If main thread, fail now 'cause not sleeping 98N/A}
// class ManualMainTest 98N/A//This exception is used to exit from any level of call nesting 98N/A// when it's determined that the test has passed, and immediately 98N/A//*********** End Standard Test Machinery Section ********** 98N/A//************ Begin classes defined for the test **************** 98N/A// make listeners in a class defined here, and instantiate them in init() 98N/A/* Example of a class which may be written as part of a test 98N/Aclass NewClass implements anInterface 98N/A static int newVar = 0; 98N/A public void eventDispatched(AWTEvent e) 98N/A //Counting events to see if we get enough 98N/A if( eventCount == 20 ) 98N/A //got enough events, so pass 98N/A ManualMainTest.pass(); 98N/A else if( tries == 20 ) 98N/A //tried too many times without getting enough events so fail 98N/A ManualMainTest.fail(); 98N/A }// eventDispatched() 98N/A//************** End classes defined for the test ******************* 98N/A/**************************************************** 98N/A Standard Test Machinery 98N/A DO NOT modify anything below -- it's a standard 98N/A chunk of code whose purpose is to make user 98N/A interaction uniform, and thereby make it simpler 98N/A to read and understand someone else's test. 98N/A ****************************************************/ 98N/A This is part of the standard test machinery. 98N/A It creates a dialog (with the instructions), and is the interface 98N/A for sending text messages to the user. 98N/A To print the instructions, send an array of strings to Sysout.createDialog 98N/A WithInstructions method. Put one line of instructions per array entry. 98N/A To display a message for the tester to see, simply call Sysout.println 98N/A with the string to be displayed. 98N/A This mimics System.out.println but works within the test harness as well 98N/A println(
"Any messages for the tester will display here." );
98N/A println(
"Any messages for the tester will display here." );
98N/A /* Enables message counting for the tester. */ 98N/A This is part of the standard test machinery. It provides a place for the 98N/A test instructions to be displayed, and a place for interactive messages 98N/A to the user to be displayed. 98N/A To have the test instructions displayed, see Sysout. 98N/A To have a message to the user be displayed, see Sysout. 98N/A Do not call anything in this dialog directly. 98N/A //DO NOT call this directly, go through Sysout 98N/A //DO NOT call this directly, go through Sysout 98N/A //Clear out any current instructions 98N/A //Go down array of instruction strings 98N/A //chop up each into pieces maxSringLength long 98N/A //if longer than max then chop off first max chars to print 98N/A //Try to chop on a word boundary 98N/A }
//printInstructions() 98N/A //DO NOT call this directly, go through Sysout 98N/A //catch presses of the passed and failed buttons. 98N/A //simply call the standard pass() or fail() static methods of 98N/A}
// TestDialog class