|
| 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