Skip to content

Commit 175eb99

Browse files
author
duke
committed
Backport fb8f2a0a929ebe7f65c69741712b89bbb403ade9
1 parent 3a6b4ef commit 175eb99

File tree

2 files changed

+80
-73
lines changed

2 files changed

+80
-73
lines changed

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

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

test/jdk/java/awt/InputMethods/DiacriticsTest/DiacriticsTest.java

Lines changed: 80 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -21,30 +21,94 @@
2121
* questions.
2222
*/
2323

24+
import jdk.test.lib.Platform;
25+
import java.awt.GridLayout;
26+
import java.awt.TextArea;
27+
import java.awt.TextField;
28+
import javax.swing.JPanel;
2429

2530
/*
26-
@test
27-
@bug 8000423 7197619 8025649
28-
@summary Check if diacritical signs could be typed for TextArea and TextField
29-
@run applet/manual=yesno DiacriticsTest.html
30-
*/
31+
* @test
32+
* @bug 8000423 7197619 8025649
33+
* @summary Check if diacritical signs could be typed for TextArea and TextField
34+
* @requires (os.family == "windows" | os.family == "linux")
35+
* @library /java/awt/regtesthelpers /test/lib
36+
* @build PassFailJFrame jdk.test.lib.Platform
37+
* @run main/manual DiacriticsTest
38+
*/
3139

40+
public class DiacriticsTest {
3241

33-
import java.applet.Applet;
34-
import java.awt.*;
35-
import javax.swing.JPanel;
42+
private static final String INSTRUCTIONS_WIN = """
43+
Test run requires the following keyboard layouts to be installed:
44+
- Hungarian
45+
- A keyboard layout having compose function or compose-like key. Programmer
46+
Dvorak (http://www.kaufmann.no/roland/dvorak/) is suggested to use.
3647
48+
To the right are a text area and a text field, you should check the behavior
49+
for both of them.
3750
38-
public class DiacriticsTest extends Applet {
51+
To test the JDK-7197619 fix:
52+
Please switch to Hungarian keyboard layout and try to type diacritics
53+
(Ctrl+Alt+2 e; Ctrl+Alt+2 E)
3954
40-
public void init() {
41-
this.setLayout(new BorderLayout());
42-
}
55+
To test the JDK-8139189 fix:
56+
Please switch to Programmer Dvorak keyboard layout try to type diacritics
57+
using compose combinations (Compose+z+d, Compose+z+Shift+d).
58+
59+
The Compose key in the Programmer Dvorak layout is OEM102, the key located
60+
between the and Z keys on a standard 102-key keyboard.
61+
If you do not have this key on your keyboard, you can skip this part of the test.
62+
63+
If you can do that then the test is passed; otherwise failed.
64+
""";
65+
66+
private static final String INSTRUCTIONS_LIN = """
67+
Test run requires the following keyboard layouts to be installed:
68+
- English (US, alternative international), aka English (US, alt. intl.)
69+
- A keyboard layout having compose function or compose-like key. Programmer
70+
Dvorak (http://www.kaufmann.no/roland/dvorak/) is suggested to use.
71+
72+
To the right are a text area and a text field, you should check the behavior
73+
for both of them.
4374
44-
public void start() {
75+
To test the JDK-8000423 fix:
76+
Please switch to US alternative international layout and try to type diacritics
77+
(using the following combinations: `+e; `+u; etc.)
4578
46-
setSize(350, 200);
79+
To test the JDK-8139189 fix:
80+
Please switch to Programmer Dvorak keyboard layout try to type diacritics
81+
using compose combinations (Compose+z+d, Compose+z+Shift+d)..
4782
83+
The Compose key in the Programmer Dvorak layout is OEM102, the key located
84+
between the and Z keys on a standard 102-key keyboard.
85+
86+
If the above key does not work in the Gnome shell,
87+
it can be overridden in the system preferences:
88+
System > Keyboard > Special character entry > Compose key
89+
and set it to another key(e.g. menu key or scroll lock.)
90+
91+
If you can do that then the test is passed; otherwise failed.
92+
""";
93+
94+
public static void main(String[] args) throws Exception {
95+
String instructions = Platform.isWindows()
96+
? INSTRUCTIONS_WIN
97+
: INSTRUCTIONS_LIN;
98+
99+
PassFailJFrame
100+
.builder()
101+
.title("DiacriticsTest Instructions")
102+
.instructions(instructions)
103+
.splitUIRight(DiacriticsTest::createPanel)
104+
.testTimeOut(10)
105+
.rows((int) instructions.lines().count() + 2)
106+
.columns(50)
107+
.build()
108+
.awaitAndCheck();
109+
}
110+
111+
public static JPanel createPanel() {
48112
JPanel panel = new JPanel();
49113
panel.setLayout(new GridLayout(2, 1));
50114

@@ -54,10 +118,6 @@ public void start() {
54118
TextField txtField = new TextField();
55119
panel.add(txtField);
56120

57-
add(panel, BorderLayout.CENTER);
58-
59-
validate();
60-
setVisible(true);
121+
return panel;
61122
}
62123
}
63-

0 commit comments

Comments
 (0)