tmf: Add SWTBot test for the pattern latency table
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui.swtbot.tests / shared / org / eclipse / tracecompass / tmf / ui / swtbot / tests / shared / ConditionHelpers.java
index 00a67656442ac297723be4186e7b2d85ab777fa7..b1233907700ac00f449f3d2f79b0b471c2df6d23 100644 (file)
@@ -273,7 +273,7 @@ public final class ConditionHelpers {
                     if( cell == null ) {
                         return false;
                     }
-                    return cell.endsWith(content);
+                    return cell.contains(content);
                 } catch (Exception e) {
                 }
                 return false;
@@ -489,6 +489,7 @@ public final class ConditionHelpers {
         private @NonNull TmfTimeRange fSelectionRange;
         private @NonNull ITmfTimestamp fVisibleTime;
         private AbstractTimeGraphView fView;
+        private String fFailureMessage;
 
         private TimeGraphIsReadyCondition(AbstractTimeGraphView view, @NonNull TmfTimeRange selectionRange, @NonNull ITmfTimestamp visibleTime) {
             fView = view;
@@ -498,18 +499,28 @@ public final class ConditionHelpers {
 
         @Override
         public boolean test() throws Exception {
-            if (!ConditionHelpers.selectionRange(fSelectionRange).test()) {
+            ICondition selectionRangeCondition = ConditionHelpers.selectionRange(fSelectionRange);
+            if (!selectionRangeCondition.test()) {
+                fFailureMessage = selectionRangeCondition.getFailureMessage();
                 return false;
             }
-            if (!TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(fVisibleTime)) {
+            @NonNull TmfTimeRange curWindowRange = TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange();
+            if (!curWindowRange.contains(fVisibleTime)) {
+                fFailureMessage = "Current window range " + curWindowRange + " does not contain " + fVisibleTime;
                 return false;
             }
-            return !fView.isDirty();
+
+            if (fView.isDirty()) {
+                fFailureMessage = "Time graph is dirty";
+                return false;
+
+            }
+            return true;
         }
 
         @Override
         public String getFailureMessage() {
-            return "Time graph is not ready";
+            return fFailureMessage;
         }
     }
 
This page took 0.0259 seconds and 5 git commands to generate.