lttng: Fix ControlFlowViewFindTest and ResourcesViewFindTest on Mac
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Mon, 11 Jul 2016 23:25:13 +0000 (19:25 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 14 Jul 2016 17:04:30 +0000 (13:04 -0400)
Some keyboard shortcuts were wrong on Mac. Going to the top of a tree
is Option-Up instead of Home and Ctrl-F should be Command-F.

Change-Id: Ic10243095ed47d0c9dd2a81b2d7cdda010ec9578
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/77104
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
lttng/org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/kernel/ui/swtbot/tests/FindDialogTestBase.java
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java

index 10b14fefe552937eafdaf4c71882755e4def5a0e..092d60160533c6423871a93e3f87c68ab2765d7c 100644 (file)
@@ -21,6 +21,7 @@ import org.eclipse.swtbot.swt.finder.keyboard.Keyboard;
 import org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory;
 import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
 import org.eclipse.swtbot.swt.finder.matchers.WidgetOfType;
+import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
 import org.eclipse.swtbot.swt.finder.waits.Conditions;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
@@ -34,6 +35,7 @@ import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
 import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl;
@@ -103,8 +105,12 @@ public abstract class FindDialogTestBase extends KernelTestBase {
 
     private static void openDialog(SWTBotView view) {
         view.setFocus();
-        KEYBOARD.pressShortcut(Keystrokes.HOME);
-        KEYBOARD.pressShortcut(Keystrokes.CTRL, KeyStroke.getInstance('F'));
+        SWTBotUtils.pressShortcutGoToTreeTop(KEYBOARD);
+        if (SWTUtils.isMac()) {
+            KEYBOARD.pressShortcut(Keystrokes.COMMAND, KeyStroke.getInstance('F'));
+        } else {
+            KEYBOARD.pressShortcut(Keystrokes.CTRL, KeyStroke.getInstance('F'));
+        }
         fBot.waitUntil(Conditions.shellIsActive(DIALOG_TITLE));
     }
 
index 042ab9721dca54f0f8032a9cf08a24f216c23378..c5d25f03f467fe39d8040765b5351a7d721d8c1f 100644 (file)
@@ -47,6 +47,8 @@ import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
 import org.eclipse.swtbot.swt.finder.SWTBot;
 import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.keyboard.Keyboard;
+import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
 import org.eclipse.swtbot.swt.finder.results.Result;
 import org.eclipse.swtbot.swt.finder.results.VoidResult;
 import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
@@ -835,6 +837,21 @@ public final class SWTBotUtils {
         return currentNode;
     }
 
+    /**
+     * Press the keyboard shortcut that goes to the top of a tree widget. The
+     * key combination can differ on different platforms.
+     *
+     * @param keyboard
+     *            the keyboard to use
+     */
+    public static void pressShortcutGoToTreeTop(Keyboard keyboard) {
+        if (SWTUtils.isMac()) {
+            keyboard.pressShortcut(Keystrokes.ALT, Keystrokes.UP);
+        } else {
+            keyboard.pressShortcut(Keystrokes.HOME);
+        }
+    }
+
     /**
      * Get the active events editor. Note that this will wait until such editor
      * is available.
This page took 0.029419 seconds and 5 git commands to generate.