timing.swtbot: add flamegraph doubleclick on row test
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.timing.ui.swtbot.tests / src / org / eclipse / tracecompass / analysis / timing / ui / swtbot / tests / flamegraph / FlameGraphTest.java
index 52e13988a6d04768e44a97137fd11569c7a2fee7..439a2cd4793705a6884c03ae4d5730910bb59669 100644 (file)
@@ -34,6 +34,10 @@ import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
 import org.eclipse.tracecompass.analysis.timing.core.tests.flamegraph.AggregationTreeTest;
 import org.eclipse.tracecompass.internal.analysis.timing.ui.flamegraph.FlameGraphPresentationProvider;
 import org.eclipse.tracecompass.internal.analysis.timing.ui.flamegraph.FlameGraphView;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
 import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphViewer;
@@ -45,6 +49,7 @@ import org.eclipse.ui.IViewPart;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
+import org.junit.Test;
 import org.junit.runner.RunWith;
 
 /**
@@ -126,8 +131,7 @@ public class FlameGraphTest extends AggregationTreeTest {
                 .filter(i -> (i instanceof TimeEvent)).filter(j -> !(j instanceof NullTimeEvent))
                 .findFirst();
         assertTrue(actualEventOpt.isPresent());
-        ITimeEvent actualEvent = actualEventOpt.get();
-        return actualEvent;
+        return actualEventOpt.get();
     }
 
     @Override
@@ -219,6 +223,29 @@ public class FlameGraphTest extends AggregationTreeTest {
         assertTrue(tooltip.toString().contains("duration=40 ns"));
     }
 
+    /**
+     * Try to zoom by doubleclicking an event
+     *
+     * @throws InterruptedException
+     *             on interruption
+     */
+    @Test
+    public void tryMouseDoubleclickZoom() throws InterruptedException {
+        super.treeTest();
+        loadFlameGraph();
+
+        SWTBotTimeGraph sbtg = new SWTBotTimeGraph(fView.bot());
+        // Test the number of timegraph entries in the graph
+        SWTBotTimeGraphEntry sbtge = sbtg.getEntry("Thread");
+        assertEquals(3, sbtge.getEntries().length);
+        SWTBotTimeGraphEntry actualEntry = sbtge.getEntry("1");
+
+        actualEntry.doubleClick(40);
+        fFg.waitForUpdate();
+
+        assertEquals(new TmfTimeRange(TmfTimestamp.fromNanos(0), TmfTimestamp.fromNanos(80)), new TmfTimeRange(TmfTimestamp.fromNanos(fTimeGraphViewer.getTime0()), TmfTimestamp.fromNanos(fTimeGraphViewer.getTime1())));
+    }
+
     /**
      * Takes too much ram
      */
This page took 0.024476 seconds and 5 git commands to generate.