20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * test |
25 @test |
26 * @bug 6497426 |
26 @key headful |
27 * @summary Tests that pressing of Ctrl+ascii mostly fires KEY_TYPED with a Unicode control symbols |
27 @bug 6497426 |
28 * @author Yuri.Nesterenko@... area=awt.keyboard |
28 @summary ests that pressing of Ctrl+ascii mostly fires KEY_TYPED with a Unicode control symbols |
29 * @run applet CtrlASCII.html |
29 @run main CtrlASCII |
30 */ |
30 */ |
31 |
31 |
32 // Note there is no @ in front of test above. This is so that the |
|
33 // harness will not mistake this file as a test file. It should |
|
34 // only see the html file as a test file. (the harness runs all |
|
35 // valid test files, so it would run this test twice if this file |
|
36 // were valid as well as the html file.) |
|
37 // Also, note the area= after Your Name in the author tag. Here, you |
|
38 // should put which functional area the test falls in. See the |
|
39 // AWT-core home page -> test areas and/or -> AWT team for a list of |
|
40 // areas. |
|
41 // Note also the 'RobotLWTest.html' in the run tag. This should |
|
42 // be changed to the name of the test. |
|
43 |
|
44 |
|
45 /** |
|
46 * CtrlASCII.java |
|
47 * |
|
48 * @summary Tests that pressing of Ctrl+ascii mostly fires KEY_TYPED with a Unicode control symbols |
|
49 */ |
|
50 |
|
51 import java.applet.Applet; |
|
52 import java.awt.*; |
32 import java.awt.*; |
53 import java.awt.event.*; |
33 import java.awt.event.*; |
54 import java.util.*; |
34 import java.util.*; |
55 |
|
56 |
35 |
57 // |
36 // |
58 // In this test, a key listener for KEY_TYPED checks if a character typed has |
37 // In this test, a key listener for KEY_TYPED checks if a character typed has |
59 // a correspondent keycode in an initially filled hashtable. |
38 // a correspondent keycode in an initially filled hashtable. |
60 // If it does not, test fails. If character was produced by |
39 // If it does not, test fails. If character was produced by |
61 // pressing a wrong key still listed in the hashtable, test cannot detect it. |
40 // pressing a wrong key still listed in the hashtable, test cannot detect it. |
62 // Under MS Windows, unlike X Window, some Ctrl+Ascii keystrokes don't |
41 // Under MS Windows, unlike X Window, some Ctrl+Ascii keystrokes don't |
63 // produce a unicode character, so there will be no KEY_TYPED and no problem. |
42 // produce a unicode character, so there will be no KEY_TYPED and no problem. |
64 // Test doesn't try to verify Ctrl+deadkey behavior. |
43 // Test doesn't try to verify Ctrl+deadkey behavior. |
65 // |
44 // |
66 |
45 public class CtrlASCII extends Frame implements KeyListener |
67 public class CtrlASCII extends Applet implements KeyListener |
|
68 { |
46 { |
69 // Declare things used in the test, like buttons and labels here |
47 // Declare things used in the test, like buttons and labels here |
70 static Hashtable<Character, Integer> keycharHash = new Hashtable<Character, Integer>(); |
48 static Hashtable<Character, Integer> keycharHash = new Hashtable<Character, Integer>(); |
71 static boolean testFailed = false; |
49 static boolean testFailed = false; |
72 //Frame frame; |
50 //Frame frame; |