X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tmf%2Forg.eclipse.tracecompass.tmf.ui.swtbot.tests%2Fshared%2Forg%2Feclipse%2Ftracecompass%2Ftmf%2Fui%2Fswtbot%2Ftests%2Fshared%2FConditionHelpers.java;h=9d8abf3420762cadc9b4ab94a40ca0f8fd815769;hb=2d594808e2906222ad806151e020c1bd6527f9e7;hp=aa58f69fbfea8e74ffaabb75239412808083ac3c;hpb=536c36c8ed0f95a045f364e88a8f1d9b37fcde88;p=deliverable%2Ftracecompass.git diff --git a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/ConditionHelpers.java b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/ConditionHelpers.java index aa58f69fbf..9d8abf3420 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/ConditionHelpers.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/ConditionHelpers.java @@ -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;