# HG changeset patch # User arapte # Date 1462449402 -10800 # Node ID 30fda04597993786847e166e37f079e0f51ce568 # Parent 8f8ed520c0787d23a2ca3117f09af80c966e349c 8155742: [Windows] robot.keyPress(KeyEvent.VK_ALT_GRAPH) throws java.lang.IllegalArgumentException in windows Reviewed-by: rchamyal, serb diff -r 8f8ed520c078 -r 30fda0459799 jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp Thu May 05 14:44:25 2016 +0300 +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp Thu May 05 14:56:42 2016 +0300 @@ -2720,6 +2720,7 @@ {java_awt_event_KeyEvent_VK_SHIFT, VK_SHIFT}, {java_awt_event_KeyEvent_VK_CONTROL, VK_CONTROL}, {java_awt_event_KeyEvent_VK_ALT, VK_MENU}, + {java_awt_event_KeyEvent_VK_ALT_GRAPH, VK_RMENU}, {java_awt_event_KeyEvent_VK_NUM_LOCK, VK_NUMLOCK}, // Miscellaneous Windows keys diff -r 8f8ed520c078 -r 30fda0459799 jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp Thu May 05 14:44:25 2016 +0300 +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp Thu May 05 14:56:42 2016 +0300 @@ -335,6 +335,9 @@ } else { // get the scancode from the virtual key scancode = ::MapVirtualKey(vkey, 0); + if (vkey == VK_RMENU) { + dwFlags |= KEYEVENTF_EXTENDEDKEY; + } keybd_event(vkey, scancode, dwFlags, 0); } } diff -r 8f8ed520c078 -r 30fda0459799 jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java --- a/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java Thu May 05 14:44:25 2016 +0300 +++ b/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java Thu May 05 14:56:42 2016 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -21,17 +21,23 @@ * questions. */ - -import java.awt.*; -import java.awt.event.*; +import java.awt.BorderLayout; +import java.awt.Canvas; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.InputEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; import static jdk.testlibrary.Asserts.assertTrue; /* - * @test + * @test 8155742 * @summary Make sure that modifier key mask is set when robot press - * some key with one or more modifiers. - * + * some key with one or more modifiers. * @library ../../../../lib/testlibrary/ * @build ExtendedRobot * @run main ModifierRobotKeyTest @@ -60,15 +66,17 @@ } public ModifierRobotKeyTest() throws Exception { - modifierKeys = new int[3]; + modifierKeys = new int[4]; modifierKeys[0] = KeyEvent.VK_SHIFT; modifierKeys[1] = KeyEvent.VK_CONTROL; modifierKeys[2] = KeyEvent.VK_ALT; + modifierKeys[3] = KeyEvent.VK_ALT_GRAPH; - inputMasks = new int[3]; + inputMasks = new int[4]; inputMasks[0] = InputEvent.SHIFT_MASK; inputMasks[1] = InputEvent.CTRL_MASK; inputMasks[2] = InputEvent.ALT_MASK; + inputMasks[3] = InputEvent.ALT_GRAPH_MASK; modifierStatus = new boolean[modifierKeys.length]; diff -r 8f8ed520c078 -r 30fda0459799 jdk/test/java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java --- a/jdk/test/java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java Thu May 05 14:44:25 2016 +0300 +++ b/jdk/test/java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java Thu May 05 14:56:42 2016 +0300 @@ -44,12 +44,8 @@ = { "This test is for verifying Alt-Gr modifier of an event.", "Windows :-", - "1. Please check if Alt-Gr key is present on keyboard.", - "2. If present, press the Alt-Gr key and perform", - " mouse click on the TestWindow.", - "3. If Alt-Gr key is not present, press Ctrl+Alt keys &", - " perform mouse click on the TestWindow.", - "4. Test will exit by itself with appropriate result.", + "1. Click Pass.", + "2. Alt-Gr modifier is tested under Robot tests.", " ", "Linux :-", "1. Please check if Alt-Gr key is present on keyboard.",