8328398: Convert java/awt/im/4490692/bug4490692.html applet test to main
Reviewed-by: achung, azvegint
This commit is contained in:
parent
46809b396c
commit
0efd9dc09b
@ -1,61 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
or visit www.oracle.com if you need additional information or have any
|
|
||||||
questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<!--
|
|
||||||
@test
|
|
||||||
@bug 4490692
|
|
||||||
@author Naoto Sato
|
|
||||||
@ignore The fix for this problem was backed out for 5057184. Remove this "ignore" tag when it is fixed again.
|
|
||||||
@run applet/manual=yesno bug4490692.html
|
|
||||||
-->
|
|
||||||
<head>
|
|
||||||
<title>Test for KEY_PRESS event for accented characters</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h1>Test for KEY_PRESS event for accented characters: Bug id 4490692</h1>
|
|
||||||
|
|
||||||
This test is for unix platforms only. Press OK if you are not
|
|
||||||
testing on those platforms.
|
|
||||||
|
|
||||||
Before the test, you need to modify the keyboard mapping for X by issueing
|
|
||||||
the following command:
|
|
||||||
|
|
||||||
xmodmap -e 'keycode 60 = aacute' (this is for Solaris Sparc keyboard)
|
|
||||||
xmodmap -e 'keycode 23 = aacute' (this is for Linux PC keyboard)
|
|
||||||
|
|
||||||
This command lets you type 'a with acute' character when you press 'Tab' keytop. <b>Please
|
|
||||||
do not fail to restore the original key mapping by doing the following after the test</b>
|
|
||||||
|
|
||||||
xmodmap -e 'keycode 60 = Tab' (this is for Solaris Sparc keyboard)
|
|
||||||
xmodmap -e 'keycode 23 = Tab' (this is for Linux PC keyboard)
|
|
||||||
|
|
||||||
Confirm the following two behaviors:
|
|
||||||
|
|
||||||
"KEYPRESS received for aacute" is displayed when you press 'Tab' keytop.
|
|
||||||
On Solaris Sparc keyboard, The key sequence ("Compose", "a", "'") generates a-acute character in en_US locale
|
|
||||||
|
|
||||||
<APPLET CODE="bug4490692.class" WIDTH=0 HEIGHT=0></APPLET>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,70 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @bug 4490692
|
|
||||||
* @author Naoto Sato
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.*;
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
public class bug4490692 extends javax.swing.JApplet {
|
|
||||||
public void init() {
|
|
||||||
new TestFrame();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class TestFrame extends JFrame implements KeyListener {
|
|
||||||
JTextField text;
|
|
||||||
JLabel label;
|
|
||||||
|
|
||||||
TestFrame () {
|
|
||||||
text = new JTextField();
|
|
||||||
text.addKeyListener(this);
|
|
||||||
label = new JLabel(" ");
|
|
||||||
Container c = getContentPane();
|
|
||||||
BorderLayout borderLayout1 = new BorderLayout();
|
|
||||||
c.setLayout(borderLayout1);
|
|
||||||
c.add(text, BorderLayout.CENTER);
|
|
||||||
c.add(label, BorderLayout.SOUTH);
|
|
||||||
setSize(300, 200);
|
|
||||||
setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void keyPressed(KeyEvent e) {
|
|
||||||
if (e.getKeyChar() == 0x00e1) {
|
|
||||||
label.setText("KEYPRESS received for aacute");
|
|
||||||
} else {
|
|
||||||
label.setText(" ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void keyTyped(KeyEvent e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void keyReleased(KeyEvent e) {
|
|
||||||
}
|
|
||||||
}
|
|
107
test/jdk/java/awt/im/bug4490692.java
Normal file
107
test/jdk/java/awt/im/bug4490692.java
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.event.KeyAdapter;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 4490692
|
||||||
|
* @summary [Linux] Test for KEY_PRESS event for accented characters.
|
||||||
|
* @requires (os.family == "linux")
|
||||||
|
* @library /java/awt/regtesthelpers
|
||||||
|
* @build PassFailJFrame
|
||||||
|
* @run main/manual bug4490692
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class bug4490692 {
|
||||||
|
private static final String INSTRUCTIONS = """
|
||||||
|
This test is for unix platforms only.
|
||||||
|
Before the test, you need to modify the keyboard mapping for
|
||||||
|
Tab by issuing the following command:
|
||||||
|
|
||||||
|
xmodmap -e 'keycode 23 = aacute' (this is for Linux)
|
||||||
|
xmodmap -e 'keycode 60 = aacute' (this is for Solaris Sparc)
|
||||||
|
|
||||||
|
This command lets you type 'a with acute (à)' character when you press
|
||||||
|
'Tab' key in the JTextField provided below the logging area.
|
||||||
|
After the test, please DO NOT fail to restore the original
|
||||||
|
key mapping by doing the following.
|
||||||
|
|
||||||
|
xmodmap -e 'keycode 23 = Tab' (this is for Linux)
|
||||||
|
xmodmap -e 'keycode 60 = Tab' (this is for Solaris Sparc)
|
||||||
|
|
||||||
|
CASE 1: This is a manual check and for SOLARIS SPARC keyboard
|
||||||
|
only. Check whether the key sequence ("Compose", "a", " ' ")
|
||||||
|
generates a-acute character in en_US locale.
|
||||||
|
|
||||||
|
CASE 2: This step is automated and applicable for both
|
||||||
|
keyboards - LINUX & SOLARIS SPARC.
|
||||||
|
When Tab key is pressed it should generate a-acute (à)
|
||||||
|
character, this test automatically passes if the correct character
|
||||||
|
is generated on keypress else fails.
|
||||||
|
""";
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
PassFailJFrame.builder()
|
||||||
|
.title("Test Instructions")
|
||||||
|
.instructions(INSTRUCTIONS)
|
||||||
|
.rows((int) INSTRUCTIONS.lines().count() + 2)
|
||||||
|
.columns(45)
|
||||||
|
.testTimeOut(10)
|
||||||
|
.splitUIBottom(bug4490692::createUI)
|
||||||
|
.logArea(8)
|
||||||
|
.build()
|
||||||
|
.awaitAndCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JComponent createUI() {
|
||||||
|
JPanel panel = new JPanel();
|
||||||
|
JTextField textField = new JTextField("", 20);
|
||||||
|
panel.add(new JLabel("Text field:"));
|
||||||
|
|
||||||
|
textField.addKeyListener(new KeyAdapter() {
|
||||||
|
@Override
|
||||||
|
public void keyPressed(KeyEvent e) {
|
||||||
|
PassFailJFrame.log(e.paramString());
|
||||||
|
if (e.getKeyCode() == 23 || e.getKeyCode() == 60
|
||||||
|
|| e.paramString().contains("rawCode=23")
|
||||||
|
|| e.paramString().contains("rawCode=60")) {
|
||||||
|
if (e.getKeyChar() == 0x00e1) {
|
||||||
|
PassFailJFrame.forcePass();
|
||||||
|
} else {
|
||||||
|
PassFailJFrame.forceFail("Tab keypress DID NOT"
|
||||||
|
+ " produce the expected accented character - aacute");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
panel.add(textField);
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user