From 7eaffe0b240103e8c62550a6fd4fa397244a3ecc Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 29 Mar 2017 16:23:49 +0300 Subject: [PATCH] ui: generate valid keystrokes in KeymapsTestCase ActionManagerEx#getKeyStroke and KeyStrokeAdapter use different case --- .../src/com/intellij/keymap/KeymapsTestCase.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/platform/testFramework/extensions/src/com/intellij/keymap/KeymapsTestCase.java b/platform/testFramework/extensions/src/com/intellij/keymap/KeymapsTestCase.java index 3763a988c5d4..25b0137f41d7 100644 --- a/platform/testFramework/extensions/src/com/intellij/keymap/KeymapsTestCase.java +++ b/platform/testFramework/extensions/src/com/intellij/keymap/KeymapsTestCase.java @@ -668,20 +668,28 @@ public abstract class KeymapsTestCase extends PlatformTestCase { return new KeyboardShortcut(fst, snd); } - private static String getText(Shortcut shortcut) { + @NotNull + private static String getText(@NotNull Shortcut shortcut) { if (shortcut instanceof KeyboardShortcut) { KeyStroke fst = ((KeyboardShortcut)shortcut).getFirstKeyStroke(); - String s = KeyStrokeAdapter.toString(fst); + String s = getText(fst); KeyStroke snd = ((KeyboardShortcut)shortcut).getSecondKeyStroke(); if (snd != null) { - s += "," + KeyStrokeAdapter.toString(snd); + s += "," + getText(snd); } return s; } return KeymapUtil.getShortcutText(shortcut); } + private static String getText(KeyStroke fst) { + String text = KeyStrokeAdapter.toString(fst); + int offset = text.lastIndexOf(' '); + if (offset == -1) offset = 0; + return text.substring(0, offset) + text.substring(offset).toUpperCase(Locale.ENGLISH); + } + private static void convertMac(@NotNull Shortcut[] there) { for (int i = 0; i < there.length; i++) { there[i] = MacOSDefaultKeymap.convertShortcutFromParent(there[i]);