3261N/A * Copyright (c) 1998, 2007, Oracle and/or its affiliates. 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 2362N/A * published by the Free Software Foundation. 2362N/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. 0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 0N/A @bug 4116029 4300383 0N/A @summary verify that child components can draw only inside their 0N/A @author das@sparc.spb.su area=awt.print 0N/A// Note there is no @ in front of test above. This is so that the 0N/A// harness will not mistake this file as a test file. It should 0N/A// only see the html file as a test file. (the harness runs all 0N/A// valid test files, so it would run this test twice if this file 0N/A// were valid as well as the html file.) 0N/A// Also, note the area= after Your Name in the author tag. Here, you 0N/A// should put which functional area the test falls in. See the 0N/A// AWT-core home page -> test areas and/or -> AWT team for a list of 0N/A// There are several places where ManualYesNoTest appear. It is 0N/A// recommended that these be changed by a global search and replace, 0N/A * summary: verify that child components can draw only inside their 0N/A//Manual tests should run as applet tests if possible because they 0N/A// get their environments cleaned up, including AWT threads, any 0N/A// test created threads, and any system resources used by the test 4195N/A// such as file descriptors. (This is normally not a problem as 4195N/A// main tests usually run in a separate VM, however on some platforms 0N/A// such as the Mac, separate VMs are not possible and non-applet 0N/A// tests will cause problems). Also, you don't have to worry about 0N/A// synchronisation stuff in Applet tests the way you do in main 0N/A //Declare things used in the test, like buttons and labels here 0N/A // The frame is sized so that only the upper part of 0N/A // the canvas is visible. We draw on the lower part, 0N/A // so that we can verify that the output is clipped 1696N/A // by the parent container bounds. 0N/A //Create instructions for the user here, as well as set up 0N/A // the environment -- set the layout manager, add buttons, 0N/A "1.Look at the frame titled \"PrintTest\". If you see green or",
0N/A " red lines on the white area below the \"Print\" button, the",
0N/A " test fails. Otherwise go to step 2.",
0N/A "2.Press \"Print\" button. The print dialog will appear. Select",
0N/A " a printer and proceed. Look at the output. If you see multiple",
0N/A " lines outside of the frame bounds or in the white area below",
0N/A " the image of the \"Print\" button, the test fails. Otherwise",
0N/A //Get things going. Request focus, set size, et cetera 0N/A //What would normally go into main() will probably go here. 0N/A //Use System.out.println for diagnostic messages that you want 0N/A // to read after the test is done. 0N/A //Use Sysout.println for messages you want the tester to read. 0N/A //The rest of this class is the actions which perform the test... 0N/A //Use Sysout.println to communicate with the user NOT System.out!! 0N/A //Sysout.println ("Something Happened!"); 0N/A }
// class ConstrainedPrintingTest 0N/A/* Place other classes related to the test after this line */ 0N/A/**************************************************** 0N/A Standard Test Machinery 0N/A DO NOT modify anything below -- it's a standard 0N/A chunk of code whose purpose is to make user 0N/A interaction uniform, and thereby make it simpler 0N/A to read and understand someone else's test. 0N/A ****************************************************/ 0N/A This is part of the standard test machinery. 0N/A It creates a dialog (with the instructions), and is the interface 0N/A for sending text messages to the user. 0N/A To print the instructions, send an array of strings to Sysout.createDialog 0N/A WithInstructions method. Put one line of instructions per array entry. 0N/A To display a message for the tester to see, simply call Sysout.println 0N/A with the string to be displayed. 0N/A This mimics System.out.println but works within the test harness as well 0N/A println(
"Any messages for the tester will display here." );
0N/A This is part of the standard test machinery. It provides a place for the 0N/A test instructions to be displayed, and a place for interactive messages 0N/A to the user to be displayed. 0N/A To have the test instructions displayed, see Sysout. 0N/A To have a message to the user be displayed, see Sysout. 0N/A Do not call anything in this dialog directly. 1057N/A //DO NOT call this directly, go through Sysout 0N/A //DO NOT call this directly, go through Sysout 0N/A //Clear out any current instructions 1057N/A //Go down array of instruction strings 1057N/A //chop up each into pieces maxSringLength long 1057N/A //if longer than max then chop off first max chars to print 544N/A //Try to chop on a word boundary 0N/A }
//printInstructions() 0N/A //DO NOT call this directly, go through Sysout