Skip to content

Commit 7cb31f3

Browse files
committed
8328012: Convert InputMethod (/java/awt/im) applet tests to main
Backport-of: 4f8f48654e500e875d14e6b4707ab654acc59176
1 parent a05cf4d commit 7cb31f3

File tree

6 files changed

+157
-170
lines changed

6 files changed

+157
-170
lines changed

test/jdk/java/awt/im/8132503/bug8132503.html

Lines changed: 0 additions & 38 deletions
This file was deleted.

test/jdk/java/awt/im/8132503/bug8132503.java

Lines changed: 0 additions & 47 deletions
This file was deleted.

test/jdk/java/awt/im/8148984/bug8148984.html

Lines changed: 0 additions & 38 deletions
This file was deleted.

test/jdk/java/awt/im/8148984/bug8148984.java

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
import javax.swing.JComponent;
25+
import javax.swing.JLabel;
26+
import javax.swing.JPanel;
27+
import javax.swing.JTextField;
28+
29+
/*
30+
* @test
31+
* @bug 8148984
32+
* @summary Verify that Chinese comma can be entered in JTextField
33+
* with Pinyin input method (IM) on OS X.
34+
* @requires (os.family == "mac")
35+
* @library /java/awt/regtesthelpers
36+
* @build PassFailJFrame
37+
* @run main/manual PinyinIMCommaTest
38+
*/
39+
40+
public class PinyinIMCommaTest {
41+
private static final String INSTRUCTIONS = """
42+
This test verifies if Chinese comma can be entered in JTextField
43+
with Pinyin input method (IM).
44+
45+
Test settings:
46+
Go to "System Preferences -> Keyboard -> Input Sources" and
47+
add "Pinyin – Traditional" or "Pinyin – Simplified" IM from Chinese language group.
48+
Set current IM to "Pinyin".
49+
50+
1. Set focus to the text field below and press "comma" character
51+
on the keyboard.
52+
2. Now change the current IM to the IM used before "Pinyin" or to "U.S".
53+
Press comma character again.
54+
3. You should notice a difference in the comma. Pinyin IM should output
55+
full width comma "\uff0c" and the other IM should output a Latin comma "\u002c".
56+
57+
If above is true press "PASS", if "\u002c" character is displayed for Pinyin IM, press "FAIL".
58+
""";
59+
60+
public static void main(String[] args) throws Exception {
61+
PassFailJFrame.builder()
62+
.title("Test Comma using Pinyin Input Method")
63+
.instructions(INSTRUCTIONS)
64+
.rows((int) INSTRUCTIONS.lines().count() + 2)
65+
.columns(45)
66+
.splitUIBottom(PinyinIMCommaTest::createUI)
67+
.testTimeOut(10)
68+
.build()
69+
.awaitAndCheck();
70+
}
71+
72+
private static JComponent createUI() {
73+
JPanel panel = new JPanel();
74+
panel.add(new JLabel("Text field:"));
75+
panel.add(new JTextField(20));
76+
return panel;
77+
}
78+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
import javax.swing.JComponent;
25+
import javax.swing.JLabel;
26+
import javax.swing.JPanel;
27+
import javax.swing.JTextArea;
28+
29+
/*
30+
* @test
31+
* @bug 8132503
32+
* @summary [macosx] Chinese full stop symbol cannot be entered with Pinyin IM on OS X
33+
* @requires (os.family == "mac")
34+
* @library /java/awt/regtesthelpers
35+
* @build PassFailJFrame
36+
* @run main/manual PinyinIMFullstopTest
37+
*/
38+
39+
public class PinyinIMFullstopTest {
40+
private static final String INSTRUCTIONS = """
41+
This test verifies if Chinese full stop symbol can be entered in JTextArea
42+
with Pinyin input method (IM).
43+
44+
Test settings:
45+
Go to "System Preferences -> Keyboard -> Input Sources" and
46+
add "Pinyin – Traditional" or "Pinyin – Simplified" IM from Chinese language group.
47+
Set current IM to "Pinyin".
48+
49+
1. Set focus to the text area below and press "dot" character
50+
on the keyboard.
51+
2. Now change the current IM to the IM used before "Pinyin" or to "U.S".
52+
Press dot character again.
53+
3. You should notice a difference in the dot. Pinyin IM should output
54+
"。" and the other IM should output "."
55+
56+
If above is true press "PASS", if normal fullstop "." character is displayed
57+
for Pinyin IM, press "FAIL".
58+
""";
59+
60+
public static void main(String[] args) throws Exception {
61+
PassFailJFrame.builder()
62+
.title("Test Dot using Pinyin Input Method")
63+
.instructions(INSTRUCTIONS)
64+
.rows((int) INSTRUCTIONS.lines().count() + 2)
65+
.columns(45)
66+
.splitUIBottom(PinyinIMFullstopTest::createUI)
67+
.testTimeOut(10)
68+
.build()
69+
.awaitAndCheck();
70+
}
71+
72+
private static JComponent createUI() {
73+
JPanel panel = new JPanel();
74+
JTextArea textArea = new JTextArea(5, 40);
75+
panel.add(new JLabel("Text Area:"));
76+
panel.add(textArea);
77+
return panel;
78+
}
79+
}

0 commit comments

Comments
 (0)