Test toolbar when pinned for cfv and resource view
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests / src / org / eclipse / tracecompass / lttng2 / kernel / ui / swtbot / tests / ControlFlowViewTest.java
index 1ce0a6cb48400cf2b76512e469b594c0d066ee61..05db69484cbd16d4c48056ad83645e097c25cf46 100644 (file)
 package org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import java.util.Arrays;
+import java.util.List;
+
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.swt.SWT;
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
@@ -27,7 +29,6 @@ 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.results.VoidResult;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@@ -54,7 +55,7 @@ import org.junit.runner.RunWith;
  * @author Patrick Tasse
  */
 @RunWith(SWTBotJunit4ClassRunner.class)
-public class ControlFlowViewTest extends KernelTestBase {
+public class ControlFlowViewTest extends KernelTimeGraphViewTestBase {
 
     private static final String CHECK_SELECTED = "Check selected";
     private static final String CHECK_ALL = "Check all";
@@ -65,7 +66,6 @@ public class ControlFlowViewTest extends KernelTestBase {
     private static final String UNCHECK_SUBTREE = "Uncheck subtree";
     private static final String UNCHECK_INACTIVE = "Uncheck Inactive";
 
-
     private static final String FOLLOW_CPU_BACKWARD = "Follow CPU Backward";
     private static final String FOLLOW_CPU_FORWARD = "Follow CPU Forward";
     private static final String SELECT_PREVIOUS_STATE_CHANGE = "Select Previous State Change";
@@ -87,6 +87,28 @@ public class ControlFlowViewTest extends KernelTestBase {
 
     private SWTBotView fViewBot;
 
+    @Override
+    protected SWTBotView getViewBot() {
+        return fViewBot;
+    }
+
+    @Override
+    protected List<String> getLegendValues() {
+        return Arrays.asList("UNKNOWN", "WAIT_UNKNOWN", "WAIT_BLOCKED", "WAIT_FOR_CPU", "USERMODE", "SYSCALL", "INTERRUPTED");
+    }
+
+    @Override
+    protected List<String> getToolbarTooltips() {
+        return Arrays.asList(PIN_VIEW_TOOLTIP, SEPARATOR,
+                ALIGN_VIEW_TOOLTIP, "Optimize", SEPARATOR,
+                "Show View Filters", "Show Legend", SEPARATOR,
+                "Reset the Time Scale to Default", "Select Previous State Change", "Select Next State Change", SEPARATOR,
+                "Add Bookmark...", "Previous Marker", "Next Marker", SEPARATOR,
+                "Select Previous Process", "Select Next Process", "Zoom In", "Zoom Out", SEPARATOR,
+                "Hide Arrows", "Follow CPU Backward", "Follow CPU Forward",
+                "Go to previous event of the selected thread", "Go to next event of the selected thread" );
+    }
+
     /**
      * Before Test
      */
@@ -111,7 +133,8 @@ public class ControlFlowViewTest extends KernelTestBase {
     }
 
     /**
-     * Test tool bar buttons "Select Next State Change" and "Select Previous State Change"
+     * Test tool bar buttons "Select Next State Change" and "Select Previous
+     * State Change"
      */
     @Test
     public void testToolBarSelectNextPreviousStateChange() {
@@ -221,24 +244,6 @@ public class ControlFlowViewTest extends KernelTestBase {
         assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(START_TIME));
     }
 
-    /**
-     * Test the legend content
-     */
-    @Test
-    public void testLegend() {
-        String[] labelValues = { "UNKNOWN", "WAIT_UNKNOWN", "WAIT_BLOCKED", "WAIT_FOR_CPU", "USERMODE", "SYSCALL", "INTERRUPTED" };
-        SWTBotToolbarButton legendButton = fViewBot.toolbarButton("Show Legend");
-        legendButton.click();
-        fBot.waitUntil(org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive("States Transition Visualizer"));
-        SWTBot bot = fBot.activeShell().bot();
-        for (int i = 1; i < 8; i++) {
-            SWTBotLabel label = bot.label(i);
-            assertNotNull(label);
-            assertEquals(labelValues[i - 1], label.getText());
-        }
-        bot.button("OK").click();
-    }
-
     /**
      * Test the filter
      */
This page took 0.025432 seconds and 5 git commands to generate.