6979551: closed/javax/swing/plaf/basic/BasicLabelUI/4798542/bug4798542.java fails
authordav
Wed, 27 Apr 2011 18:15:27 +0400
changeset 9494 f007c17f02a6
parent 9493 249a58037fde
child 9495 f0b0ad903f6f
6979551: closed/javax/swing/plaf/basic/BasicLabelUI/4798542/bug4798542.java fails Reviewed-by: art, yan, alexp
jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java
jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java
--- a/jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java	Wed Apr 27 17:46:59 2011 +0400
+++ b/jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java	Wed Apr 27 18:15:27 2011 +0400
@@ -13,7 +13,7 @@
      */
      // Keycodes declared in KeyEvent.java with corresponding Unicode values.
      private final static HashMap<Integer, Integer>  regularKeyCodesMap =
-                                          new HashMap<Integer,Integer>(83, 1.0f);
+                                          new HashMap<Integer,Integer>(98, 1.0f);
 
      // Keycodes derived from Unicode values. Here should be collected codes
      // for characters appearing on the primary layer of at least one
@@ -108,6 +108,21 @@
          regularKeyCodesMap.put(0x5E, KeyEvent.VK_CIRCUMFLEX);
          regularKeyCodesMap.put(0x5F, KeyEvent.VK_UNDERSCORE);
          regularKeyCodesMap.put(0x60, KeyEvent.VK_BACK_QUOTE);
+         regularKeyCodesMap.put(0x61, KeyEvent.VK_A);
+         regularKeyCodesMap.put(0x62, KeyEvent.VK_B);
+         regularKeyCodesMap.put(0x63, KeyEvent.VK_C);
+         regularKeyCodesMap.put(0x64, KeyEvent.VK_D);
+         regularKeyCodesMap.put(0x65, KeyEvent.VK_E);
+         regularKeyCodesMap.put(0x66, KeyEvent.VK_F);
+         regularKeyCodesMap.put(0x67, KeyEvent.VK_G);
+         regularKeyCodesMap.put(0x68, KeyEvent.VK_H);
+         regularKeyCodesMap.put(0x69, KeyEvent.VK_I);
+         regularKeyCodesMap.put(0x6A, KeyEvent.VK_J);
+         regularKeyCodesMap.put(0x6B, KeyEvent.VK_K);
+         regularKeyCodesMap.put(0x6C, KeyEvent.VK_L);
+         regularKeyCodesMap.put(0x6D, KeyEvent.VK_M);
+         regularKeyCodesMap.put(0x6E, KeyEvent.VK_N);
+         regularKeyCodesMap.put(0x6F, KeyEvent.VK_O);
          regularKeyCodesMap.put(0x70, KeyEvent.VK_P);
          regularKeyCodesMap.put(0x71, KeyEvent.VK_Q);
          regularKeyCodesMap.put(0x72, KeyEvent.VK_R);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java	Wed Apr 27 18:15:27 2011 +0400
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2011, 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.
+ */
+
+/*
+  @test
+  @bug 6799551
+  @library ../../regtesthelpers
+  @build Util Sysout
+  @summary Extended key codes for small letters undefined
+  @author Andrei Dmitriev: area=awt.keyboard
+  @run main EqualKeyCode
+*/
+
+
+import sun.awt.*;
+import java.awt.*;
+import test.java.awt.regtesthelpers.Util;
+import test.java.awt.regtesthelpers.Sysout;
+
+public class EqualKeyCode {
+
+    final static String LETTERS = "abcdefghijklmnopqrstuvwxyz";
+
+    public static void main(String []s) {
+        for (int i = 0; i < LETTERS.length(); i++){
+            char cSmall = LETTERS.charAt(i);
+            char cLarge = Character.toUpperCase(cSmall);
+
+            int iSmall = ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall);
+            int iLarge = ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge);
+
+            System.out.print(" " + cSmall + ":" + iSmall + " ---- ");
+            System.out.println(" " + cLarge + " : " + iLarge);
+            if (ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall) !=
+                ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge))
+            {
+                throw new RuntimeException("ExtendedKeyCode doesn't exist or doesn't match between capital and small letters.");
+            }
+        }
+    }
+}