Search in sources :

Example 11 with SWTBotTimeGraphEntry

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry in project tracecompass by tracecompass.

the class TimeGraphViewTest method testTimeLine.

/**
 * Test the line entries
 */
@Test
public void testTimeLine() {
    String lines = "pulse";
    resetTimeRange();
    SWTBotTimeGraph timegraph = fTimeGraph;
    assertEquals(0, timegraph.selection().columnCount());
    ImageHelper currentImage = ImageHelper.waitForNewImage(fBounds, null);
    SWTBotTimeGraphEntry entry = timegraph.getEntry(lines);
    // make sure it's visible
    entry = timegraph.getEntry(lines).select();
    ImageHelper.waitForNewImage(fBounds, currentImage);
    Rectangle rect = entry.absoluteLocation();
    ImageHelper image = ImageHelper.grabImage(rect);
    ImmutableMultiset<RGB> ms = Multisets.copyHighestCountFirst(image.getHistogram());
    int black = ms.count(new RGB(0, 0, 0));
    RGB bgColor = ms.elementSet().iterator().next();
    int bgCount = ms.count(bgColor);
    float actual = ((float) black) / (bgCount);
    assertEquals(0.113f, actual, 0.05f);
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) Rectangle(org.eclipse.swt.graphics.Rectangle) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) RGB(org.eclipse.swt.graphics.RGB) ImageHelper(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ImageHelper) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Example 12 with SWTBotTimeGraphEntry

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry in project tracecompass by tracecompass.

the class FlameChartViewTest method getVisibleStackFrames.

private static List<String> getVisibleStackFrames(final SWTBotView viewBot) {
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    List<String> stackFrames = new ArrayList<>();
    for (SWTBotTimeGraphEntry entry : timeGraph.getEntry(TRACE, PROCESS, THREAD).getEntries()) {
        String name = entry.getText();
        if (!name.isEmpty()) {
            stackFrames.add(name);
        }
    }
    return stackFrames;
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) ArrayList(java.util.ArrayList) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry)

Example 13 with SWTBotTimeGraphEntry

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry in project tracecompass by tracecompass.

the class FlameGraphTest method tryMouseDoubleclickZoom.

/**
 * 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("");
    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())));
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) AggregationTreeTest(org.eclipse.tracecompass.analysis.profiling.core.tests.flamegraph.AggregationTreeTest) Test(org.junit.Test)

Example 14 with SWTBotTimeGraphEntry

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry in project tracecompass by tracecompass.

the class XmlTimegraphViewTest method testData.

/**
 * Test that the timegraph view is open and is populated
 */
@Test
public void testData() {
    SWTBotTimeGraph timegraph = getTimegraph();
    // Test the window range
    TimeGraphControl widget = timegraph.widget;
    SWTBotUtils.waitUntil(control -> control.getTimeDataProvider().getTime0() == 1, widget, "window start time");
    SWTBotUtils.waitUntil(control -> control.getTimeDataProvider().getTime1() == 7, widget, "window end time");
    // test entries
    SWTBotTimeGraphEntry traceEntry = timegraph.getEntry(TRACE_NAME);
    SWTBotTimeGraphEntry entry = traceEntry.getEntry("checkpoint");
    assertEquals("number of entries", 1, timegraph.getEntries().length);
    assertEquals("number of entries", 1, traceEntry.getEntries().length);
    assertEquals("name of entry", "checkpoint", entry.getText());
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) TimeGraphControl(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) Test(org.junit.Test)

Aggregations

SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)14 SWTBotTimeGraphEntry (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry)14 Test (org.junit.Test)12 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)6 Point (org.eclipse.swt.graphics.Point)4 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)4 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)3 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)3 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)3 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)2 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)2 SWTBotCheckBox (org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox)2 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)2 ITimeDataProvider (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.ITimeDataProvider)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 IOException (java.io.IOException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1