@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,
*/
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
*
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
*/
@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" );