swtbot: Add SWTBotTimeGraph and update SWTBotSash
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui.swtbot.tests / shared / org / eclipse / tracecompass / tmf / ui / swtbot / tests / shared / ConditionHelpers.java
index aa58f69fbfea8e74ffaabb75239412808083ac3c..9d8abf3420762cadc9b4ab94a40ca0f8fd815769 100644 (file)
@@ -471,6 +471,39 @@ public final class ConditionHelpers {
         };
     }
 
+    /**
+     * Condition to check if the selection contains the specified text at the
+     * specified column. The text is checked in any item of the tree selection.
+     *
+     * @param tree
+     *            the SWTBot tree
+     * @param column
+     *            the column index
+     * @param text
+     *            the expected text
+     * @return ICondition for verification
+     */
+    public static ICondition timeGraphSelectionContains(final SWTBotTimeGraph timeGraph, final int column, final String text) {
+        return new SWTBotTestCondition() {
+            @Override
+            public boolean test() throws Exception {
+                TableCollection selection = timeGraph.selection();
+                for (int row = 0; row < selection.rowCount(); row++) {
+                    if (selection.get(row, column).equals(text)) {
+                        return true;
+                    }
+                }
+                return false;
+            }
+
+            @Override
+            public String getFailureMessage() {
+                return NLS.bind("Time graph selection [0,{0}]: {1} expected: {2}",
+                        new Object[] { column, timeGraph.selection().get(0, column), text});
+            }
+        };
+    }
+
     private static class EventsTableSelectionCondition extends DefaultCondition {
         private long fSelectionTime;
         private SWTWorkbenchBot fBot;
This page took 0.02474 seconds and 5 git commands to generate.