Test toolbar when pinned for cfv and resource view pin-views
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 7 Nov 2016 17:46:30 +0000 (12:46 -0500)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 11 Nov 2016 15:44:16 +0000 (10:44 -0500)
Only the pin and align views should be enabled.

Change-Id: I36fbb1e4159fa9ddc8e5f8e324b76db5fbd5b7c7
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
lttng/org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/kernel/ui/swtbot/tests/ControlFlowViewTest.java
lttng/org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/kernel/ui/swtbot/tests/KernelTimeGraphViewTestBase.java
lttng/org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/kernel/ui/swtbot/tests/ResourcesViewTest.java

index 5c1761441a6edbb4b2c953db7a1a5058dd55fd34..05db69484cbd16d4c48056ad83645e097c25cf46 100644 (file)
@@ -99,8 +99,8 @@ public class ControlFlowViewTest extends KernelTimeGraphViewTestBase {
 
     @Override
     protected List<String> getToolbarTooltips() {
-        return Arrays.asList("Pin View", SEPARATOR,
-                "Align Views", "Optimize", SEPARATOR,
+        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,
index b0b585169db31e21548ade06965daecd7253eec8..abd90045fd547511b98f0816d3f95ff417585707 100644 (file)
@@ -36,6 +36,16 @@ public abstract class KernelTimeGraphViewTestBase extends KernelTestBase {
      */
     protected static final String SEPARATOR = "";
 
+    /**
+     * Tooltip used for the pin view button
+     */
+    protected static final String PIN_VIEW_TOOLTIP = "Pin View";
+
+    /**
+     * Tooltip used for the align views button
+     */
+    protected static final String ALIGN_VIEW_TOOLTIP = "Align Views";
+
     /**
      * Get an SWTBotView of the view being tested
      *
@@ -73,6 +83,47 @@ public abstract class KernelTimeGraphViewTestBase extends KernelTestBase {
         assertEquals(tooltipsExpected, tooltips);
     }
 
+    /**
+     * Test toolbar button when pinned. Only the pin button and align should be
+     * enabled.
+     */
+    @Test
+    public void testPinnedToolbar() {
+        List<SWTBotToolbarButton> buttons = getViewBot().getToolbarButtons();
+        List<String> tooltipsExpected = getToolbarTooltips();
+        List<String> tooltips = new ArrayList<>();
+
+        /* Click the pin button */
+        getViewBot().toolbarButton(PIN_VIEW_TOOLTIP).click();
+
+        for (SWTBotToolbarButton button : buttons) {
+            tooltips.add(button.getToolTipText());
+            if (button.getToolTipText().equals(SEPARATOR)) {
+                /** Skip separator */
+                continue;
+            }
+            if (button.getToolTipText().equals(PIN_VIEW_TOOLTIP) || button.getToolTipText().equals(ALIGN_VIEW_TOOLTIP)) {
+                assertTrue(button.getText() + " enabled", button.isEnabled());
+                assertTrue(button.getText() + " visible", button.isVisible());
+            } else {
+                assertTrue(button.getText() + " disabled", !button.isEnabled());
+                assertTrue(button.getText() + " visible", button.isVisible());
+            }
+        }
+
+        assertEquals(tooltipsExpected, tooltips);
+
+        /* Return to initial state */
+        getViewBot().toolbarButton(PIN_VIEW_TOOLTIP).click();
+        tooltips.clear();
+        for (SWTBotToolbarButton button : buttons) {
+            tooltips.add(button.getToolTipText());
+            assertTrue(button.getText() + " enabled", button.isEnabled());
+            assertTrue(button.getText() + " visible", button.isVisible());
+        }
+        assertEquals(tooltipsExpected, tooltips);
+    }
+
     /**
      * Test the legend content
      */
index e2e5d7455d491370fa3dc91c8765742b7e1a7731..ec85b4f89b629811ce67ed2c6705b36b4dacf1ca 100644 (file)
@@ -95,8 +95,8 @@ public class ResourcesViewTest extends KernelTimeGraphViewTestBase {
 
     @Override
     protected List<String> getToolbarTooltips() {
-        return Arrays.asList("Pin View", SEPARATOR,
-                "Align Views", "Show View Filters", "Show Legend", SEPARATOR,
+        return Arrays.asList(PIN_VIEW_TOOLTIP, SEPARATOR,
+                ALIGN_VIEW_TOOLTIP, "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 Resource", "Select Next Resource", "Zoom In", "Zoom Out" );
This page took 0.029408 seconds and 5 git commands to generate.