Skip to content

Commit 22f10e0

Browse files
committed
8327856: Convert applet test SpanishDiacriticsTest.java to a main program
Reviewed-by: dmarkov, aivanov
1 parent 7283c8b commit 22f10e0

File tree

3 files changed

+92
-97
lines changed

3 files changed

+92
-97
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
/*
25+
* @test
26+
* @bug 8169355
27+
* @summary Check if Spanish diacritical signs could be typed for TextField
28+
* @requires (os.family == "windows")
29+
* @library /java/awt/regtesthelpers
30+
* @run main/manual SpanishDiacriticsTest
31+
*/
32+
33+
34+
import java.util.concurrent.locks.LockSupport;
35+
import java.awt.event.KeyAdapter;
36+
import java.awt.event.KeyEvent;
37+
import javax.swing.JFrame;
38+
import javax.swing.JTextField;
39+
import javax.swing.SwingUtilities;
40+
import javax.swing.WindowConstants;
41+
42+
public class SpanishDiacriticsTest {
43+
44+
static final String INSTRUCTIONS = """
45+
This test requires the following keyboard layout to be installed:
46+
Windows OS: Spanish (United States) with 'Latin American' keyboard layout.
47+
If using a US layout, the results should still be as described but
48+
you have not tested the real bug.
49+
50+
1. A frame with a text field should be displayed.
51+
2. Set focus to the text field and switch to Spanish
52+
with 'Latin American' keyboard layout.
53+
3. Type the following: ' ' o - i.e. single quote two times, then o.
54+
If your keyboard has a US physical layout the [ key can be used
55+
to type the single quote when in 'Latin American' keyboard mode.
56+
4. Type these characters at a normal speed but do NOT be concerned
57+
that they take several seconds to display. That is an
58+
expected behaviour for this test.
59+
60+
If the text field displays the same three characters you typed: ''o
61+
(i.e. two single quotes followed by o without an acute)
62+
then press Pass; otherwise press Fail.
63+
""";
64+
65+
public static void main(String[] args) throws Exception {
66+
67+
PassFailJFrame.builder()
68+
.title("Spanish Diacritics")
69+
.instructions(INSTRUCTIONS)
70+
.rows(20)
71+
.columns(50)
72+
.testUI(SpanishDiacriticsTest::createTestUI)
73+
.build()
74+
.awaitAndCheck();
75+
}
76+
77+
static JFrame createTestUI() {
78+
JFrame frame = new JFrame("Spanish Diacritics Test Frame");
79+
JTextField textField = new JTextField(20);
80+
textField.addKeyListener(new KeyAdapter() {
81+
@Override
82+
public void keyTyped(KeyEvent e) {
83+
LockSupport.parkNanos(1_000_000_000L);
84+
}
85+
});
86+
frame.add(textField);
87+
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
88+
frame.pack();
89+
return frame;
90+
}
91+
}
92+

test/jdk/java/awt/InputMethods/SpanishDiacriticsTest/SpanishDiacriticsTest.html

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

test/jdk/java/awt/InputMethods/SpanishDiacriticsTest/SpanishDiacriticsTest.java

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

0 commit comments

Comments
 (0)