changeset 8823:0d5cc1f305c6

8025126: [macosx] Invalid calls to setValueAt() within JTable in Java 7 on Mac OS X Reviewed-by: serb
author alexsch
date Fri, 15 Nov 2013 14:05:49 +0400
parents 8d17ebcef958
children d3acc0e0ca3d
files src/macosx/classes/sun/lwawt/LWWindowPeer.java test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java
diffstat 2 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Thu Nov 14 11:42:46 2013 +0400
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Nov 15 14:05:49 2013 +0400
@@ -949,7 +949,8 @@
         KeyEvent keyEvent = new KeyEvent(focusOwner, id, when, modifiers,
             keyCode, keyChar, keyLocation);
         AWTAccessor.getKeyEventAccessor().setExtendedKeyCode(keyEvent,
-            ExtendedKeyCodes.getExtendedKeyCodeForChar(keyChar));
+                (keyChar == KeyEvent.CHAR_UNDEFINED) ? keyCode
+                : ExtendedKeyCodes.getExtendedKeyCodeForChar(keyChar));
         postEvent(keyEvent);
     }
 
--- a/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java	Thu Nov 14 11:42:46 2013 +0400
+++ b/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java	Fri Nov 15 14:05:49 2013 +0400
@@ -31,7 +31,7 @@
 
 /*
  * @test
- * @bug 8007156
+ * @bug 8007156 8025126
  * @summary Extended key code is not set for a key event
  * @author Alexandr Scherbatiy
  * @run main ExtendedKeyCodeTest
@@ -44,6 +44,7 @@
     public static void main(String[] args) throws Exception {
         SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
+        robot.setAutoDelay(50);
 
         Frame frame = new Frame();
         frame.setSize(300, 300);
@@ -54,14 +55,14 @@
             public void keyPressed(KeyEvent e) {
                 eventsCount++;
                 setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode()
-                    == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
+                        == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
             }
 
             @Override
             public void keyReleased(KeyEvent e) {
                 eventsCount++;
                 setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode()
-                    == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
+                        == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
             }
         });
 
@@ -77,5 +78,29 @@
         if (eventsCount != 2 || !setExtendedKeyCode) {
             throw new RuntimeException("Wrong extended key code");
         }
+
+        frame = new Frame();
+        frame.setSize(300, 300);
+        setExtendedKeyCode = false;
+
+        frame.addKeyListener(new KeyAdapter() {
+
+            @Override
+            public void keyPressed(KeyEvent e) {
+                setExtendedKeyCode = e.getExtendedKeyCode() == KeyEvent.VK_LEFT;
+            }
+        });
+
+        frame.setVisible(true);
+        toolkit.realSync();
+
+        robot.keyPress(KeyEvent.VK_LEFT);
+        robot.keyRelease(KeyEvent.VK_LEFT);
+        toolkit.realSync();
+        frame.dispose();
+
+        if (!setExtendedKeyCode) {
+            throw new RuntimeException("Wrong extended key code!");
+        }
     }
 }