From 83dc2e3e45a946dd1302efb84baf3afaa9309ba4 Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Wed, 10 Aug 2022 03:42:12 +0000 Subject: [PATCH] 8292062: misc javax/swing tests failing Reviewed-by: prr --- .../classes/javax/swing/plaf/synth/SynthLookAndFeel.java | 2 ++ .../javax/swing/JList/4618767/JListSelectedElementTest.java | 6 +++--- .../javax/swing/JTree/4618767/JTreeSelectedElementTest.java | 6 +++--- test/jdk/javax/swing/event/RightAltKeyTest.java | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java index a4d7a6b4eee..d9cc6cf2d9f 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java @@ -724,6 +724,8 @@ public class SynthLookAndFeel extends BasicLookAndFeel { table.put("Menu.shortcutKeys", new int[] { SwingUtilities2.getSystemMnemonicKeyMask(), + SwingUtilities2.setAltGraphMask( + SwingUtilities2.getSystemMnemonicKeyMask()) }); // enabled antialiasing depending on desktop settings diff --git a/test/jdk/javax/swing/JList/4618767/JListSelectedElementTest.java b/test/jdk/javax/swing/JList/4618767/JListSelectedElementTest.java index 5eca0f3232e..b97791fdc80 100644 --- a/test/jdk/javax/swing/JList/4618767/JListSelectedElementTest.java +++ b/test/jdk/javax/swing/JList/4618767/JListSelectedElementTest.java @@ -50,7 +50,7 @@ import static javax.swing.UIManager.getInstalledLookAndFeels; /* * @test * @key headful - * @bug 4618767 + * @bug 4618767 8292062 * @summary This test confirms that typing a letter while a JList has focus now makes the selection * not jump to the item whose text starts with that letter if that typed letter is accompanied * by modifier keys such as ALT or CTRL(eg: ALT+F). @@ -117,8 +117,8 @@ public class JListSelectedElementTest { } // Now operate Menu using Mnemonics, different key combinations for different OSes. - // For most OSes it's ALT+F; on macOS it's ALT+CNTRL+F except for Nimbus LaF. - if (isMac && !laf.contains("Nimbus")) { + // For most OSes it's ALT+F; on macOS it's ALT+CNTRL+F. + if (isMac) { hitKeys(KeyEvent.VK_ALT, KeyEvent.VK_CONTROL, FILE_MENU); } else { hitKeys(KeyEvent.VK_ALT, FILE_MENU); diff --git a/test/jdk/javax/swing/JTree/4618767/JTreeSelectedElementTest.java b/test/jdk/javax/swing/JTree/4618767/JTreeSelectedElementTest.java index 19b00c05d37..3ddb7b03a9e 100644 --- a/test/jdk/javax/swing/JTree/4618767/JTreeSelectedElementTest.java +++ b/test/jdk/javax/swing/JTree/4618767/JTreeSelectedElementTest.java @@ -50,7 +50,7 @@ import static javax.swing.UIManager.getInstalledLookAndFeels; /* * @test * @key headful - * @bug 4618767 + * @bug 4618767 8292062 * @summary This test confirms that typing a letter while a JTree has focus now makes the selection * not jump to the item whose text starts with that letter if that typed letter is accompanied * by modifier keys such as ALT or CTRL(eg: ALT+F). @@ -107,8 +107,8 @@ public class JTreeSelectedElementTest { } // Now operate Menu using Mnemonics, different key combinations for different OSes. - // For most OSes it's ALT+F; on macOS it's ALT+CNTRL+F except for Nimbus LaF. - if (isMac && !laf.contains("Nimbus")) { + // For most OSes it's ALT+F; on macOS it's ALT+CNTRL+F. + if (isMac) { hitKeys(KeyEvent.VK_ALT, KeyEvent.VK_CONTROL, FILE_MENU); } else { hitKeys(KeyEvent.VK_ALT, FILE_MENU); diff --git a/test/jdk/javax/swing/event/RightAltKeyTest.java b/test/jdk/javax/swing/event/RightAltKeyTest.java index 604bde32a31..dc4132de28c 100644 --- a/test/jdk/javax/swing/event/RightAltKeyTest.java +++ b/test/jdk/javax/swing/event/RightAltKeyTest.java @@ -24,7 +24,7 @@ /* * @test * @key headful - * @bug 8194873 + * @bug 8194873 8292062 * @requires (os.family == "Windows") * @summary Checks that right ALT (ALT_GRAPH) key works on Swing components * @run main RightAltKeyTest