2362N/A * Copyright (c) 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 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * @summary Tests that pressing of Ctrl+ascii mostly fires KEY_TYPED with a Unicode control symbols 0N/A * @author Yuri.Nesterenko@... area=awt.keyboard 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// be changed to the name of the test. 0N/A * @summary Tests that pressing of Ctrl+ascii mostly fires KEY_TYPED with a Unicode control symbols 0N/A// In this test, a key listener for KEY_TYPED checks if a character typed has 0N/A// a correspondent keycode in an initially filled hashtable. 0N/A// If it does not, test fails. If character was produced by 0N/A// pressing a wrong key still listed in the hashtable, test cannot detect it. 0N/A// Under MS Windows, unlike X Window, some Ctrl+Ascii keystrokes don't 0N/A// produce a unicode character, so there will be no KEY_TYPED and no problem. 0N/A// Test doesn't try to verify Ctrl+deadkey behavior. 0N/A // Declare things used in the test, like buttons and labels here 0N/A //keycharHash.put('%', (char)0x25 ); /*37,x25*/ /*no VK, cannot test*/ 0N/A // Javadoc says: "there is no keycode for the question mark because 0N/A // there is no keyboard for which it appears on the primary layer." 0N/A // Well, it's Lithuanian standard. 0N/A //keycharHash.put('?', (char)0x3f ); /*63,x3f*/ /*no VK, cannot test*/ 0N/A /********* Same as uppercase*/ 0N/A //keycharHash.put( (char)0x1 , KeyEvent.VK_a );/*97,x61*/ 0N/A //keycharHash.put( (char)0x2 , KeyEvent.VK_b );/*98,x62*/ 0N/A //keycharHash.put( (char)0x3 , KeyEvent.VK_c );/*99,x63*/ 0N/A //keycharHash.put( (char)0x4 , KeyEvent.VK_d );/*100,x64*/ 0N/A //keycharHash.put( (char)0x5 , KeyEvent.VK_e );/*101,x65*/ 0N/A //keycharHash.put( (char)0x6 , KeyEvent.VK_f );/*102,x66*/ 0N/A //keycharHash.put( (char)0x7 , KeyEvent.VK_g );/*103,x67*/ 0N/A //keycharHash.put( (char)0x8 , KeyEvent.VK_h );/*104,x68*/ 0N/A //keycharHash.put( (char)0x9 , KeyEvent.VK_i );/*105,x69*/ 0N/A //keycharHash.put( (char)0xa , KeyEvent.VK_j );/*106,x6a*/ 0N/A //keycharHash.put( (char)0xb , KeyEvent.VK_k );/*107,x6b*/ 0N/A //keycharHash.put( (char)0xc , KeyEvent.VK_l );/*108,x6c*/ 0N/A //keycharHash.put( (char)0xd , KeyEvent.VK_m );/*109,x6d*/ 0N/A //keycharHash.put( (char)0xe , KeyEvent.VK_n );/*110,x6e*/ 0N/A //keycharHash.put( (char)0xf , KeyEvent.VK_o );/*111,x6f*/ 0N/A //keycharHash.put( (char)0x10 , KeyEvent.VK_p );/*112,x70*/ 0N/A //keycharHash.put( (char)0x11 , KeyEvent.VK_q );/*113,x71*/ 0N/A //keycharHash.put( (char)0x12 , KeyEvent.VK_r );/*114,x72*/ 0N/A //keycharHash.put( (char)0x13 , KeyEvent.VK_s );/*115,x73*/ 0N/A //keycharHash.put( (char)0x14 , KeyEvent.VK_t );/*116,x74*/ 0N/A //keycharHash.put( (char)0x15 , KeyEvent.VK_u );/*117,x75*/ 0N/A //keycharHash.put( (char)0x16 , KeyEvent.VK_v );/*118,x76*/ 0N/A //keycharHash.put( (char)0x17 , KeyEvent.VK_w );/*119,x77*/ 0N/A //keycharHash.put( (char)0x18 , KeyEvent.VK_x );/*120,x78*/ 0N/A //keycharHash.put( (char)0x19 , KeyEvent.VK_y );/*121,x79*/ 0N/A //keycharHash.put( (char)0x1a , KeyEvent.VK_z );/*122,x7a*/ 0N/A //keycharHash.put( (char)0x1c , KeyEvent.VK_| ); /*124,x7c*/ /* no VK, cannot test*/ 0N/A //keycharHash.put( (char)0x1e , KeyEvent.VK_~ ); /*126,x7e*/ /* no VK, cannot test*/ 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 // XXX test for MS Windows 0N/A "This is an AUTOMATIC test",
0N/A "simply wait until it is done" 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 // wait for focus, etc. (Hack.) 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 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. 0N/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 0N/A //Go down array of instruction strings 0N/A //chop up each into pieces maxSringLength long 0N/A //if longer than max then chop off first max chars to print 0N/A //Try to chop on a word boundary 0N/A }
//printInstructions() 0N/A //DO NOT call this directly, go through Sysout 0N/A }
// TestDialog class