Search in sources :

Example 6 with SWTBotTimeGraphEntry

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

the class ControlFlowViewTest method testDynamicFiltering.

/**
 * Test dynamic filters dialog
 */
@Test
public void testDynamicFiltering() {
    /* Change window range to 10 ms */
    TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, range.getStartTime(), range.getEndTime()));
    timeGraphIsReadyCondition(range);
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(getViewBot().bot());
    SWTBotTimeGraphEntry traceEntry = timeGraph.getEntry(LttngTraceGenerator.getName());
    SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 225, traceEntry, () -> "Entries size expected:225 actual:" + traceEntry.getEntries().length);
    getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click();
    SWTBotShell shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate();
    /* Make sure nothing is checked and radio buttons are disabled */
    SWTBotCheckBox activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX);
    assertFalse(activeThreadsCheckbox.isChecked());
    /*
         * Test Active Filter buttons toggle
         */
    activeThreadsCheckbox.click();
    /* All objects should be enabled except for the CPU ranges field */
    assertTrue(activeThreadsCheckbox.isChecked());
    shell.bot().button(DIALOG_OK).click();
    /*
         * A zoom thread is started after applying the filter. Make sure that the time graph
         * is ready before continuing with the test
         */
    timeGraphIsReadyCondition(range);
    /* Change window range to 50 us */
    range = new TmfTimeRange(START_TIME, START_TIME.normalize(50000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, range.getStartTime(), range.getEndTime()));
    timeGraphIsReadyCondition(range);
    /* Verify that number active entries changed */
    SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 7, traceEntry, () -> "Entries size expected:7 actual:" + traceEntry.getEntries().length);
    getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click();
    shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate();
    activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX);
    assertTrue(activeThreadsCheckbox.isChecked());
    /*
         * Test Active Filter buttons toggle
         */
    activeThreadsCheckbox.click();
    /* All objects should be enabled except for the CPU ranges field */
    assertFalse(activeThreadsCheckbox.isChecked());
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotCheckBox(org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test)

Example 7 with SWTBotTimeGraphEntry

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

the class ImportAndReadKernelSmokeTest method getSsNames.

@NonNull
private static Set<@NonNull Entry<String, Set<String>>> getSsNames(SWTBotView bot) {
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(bot.bot());
    SWTBotTimeGraphEntry trace = timeGraph.getEntry("synthetic-trace");
    SWTBotTimeGraphEntry[] traceEntries = timeGraph.getEntries();
    assertEquals("State system explorer should have a single trace entry: " + Arrays.toString(traceEntries), 1, traceEntries.length);
    SWTBotTimeGraphEntry[] modules = trace.getEntries();
    Map<String, Set<String>> modulesToStateSystems = new HashMap<>();
    for (SWTBotTimeGraphEntry module : modules) {
        Set<String> stateSystems = new HashSet<>();
        for (SWTBotTimeGraphEntry stateSystem : module.getEntries()) {
            stateSystems.add(stateSystem.getText());
        }
        modulesToStateSystems.put(module.getText(), stateSystems);
    }
    return modulesToStateSystems.entrySet();
}
Also used : HashSet(java.util.HashSet) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) HashMap(java.util.HashMap) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) HashSet(java.util.HashSet) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 8 with SWTBotTimeGraphEntry

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

the class TimeGraphViewTest method testExpandAndCollapse.

/**
 * Test expand and collapes of a timegraph view
 */
@Test
public void testExpandAndCollapse() {
    String pg = "Plumber guy";
    String hpc = "Hungry pie chart";
    String element = "row2";
    int totalItems = 17;
    resetTimeRange();
    SWTBotTimeGraph timegraph = fTimeGraph;
    assertEquals(totalItems, getVisibleItems(timegraph).size());
    SWTBotTimeGraphEntry[] entries = null;
    entries = timegraph.getEntries();
    assertNotNull(entries);
    assertNotNull(timegraph.getEntry(hpc, element));
    timegraph.collapseAll();
    entries = timegraph.getEntries();
    assertEquals(3, getVisibleItems(timegraph).size());
    timegraph.getEntry(pg).select();
    fireKey(timegraph, true, '+');
    assertEquals(10, getVisibleItems(timegraph).size());
    timegraph.getEntry(pg).select();
    fireKey(timegraph, true, '-');
    assertEquals(3, getVisibleItems(timegraph).size());
    timegraph.getEntry(hpc).select();
    fireKey(timegraph, true, '+');
    assertEquals(10, getVisibleItems(timegraph).size());
    assertNotNull(timegraph.getEntry(hpc, element));
    timegraph.getEntry(pg).select();
    fireKey(timegraph, true, '*');
    timegraph.getEntry(hpc).select();
    fireKey(timegraph, true, '*');
    assertEquals(totalItems, getVisibleItems(timegraph).size());
    assertNotNull(timegraph.getEntry(hpc, element));
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Example 9 with SWTBotTimeGraphEntry

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

the class TimeGraphViewTest method testBookmark.

/**
 * Test bookmark operations
 */
@Test
public void testBookmark() {
    String pg = "Plumber guy";
    SWTBotTimeGraph timegraph = fTimeGraph;
    resetTimeRange();
    SWTBotTimeGraphEntry[] entries = null;
    entries = timegraph.getEntries();
    assertNotNull(entries);
    SWTBotTimeGraphEntry entry1 = timegraph.getEntry(pg, "Hat2");
    SWTBotTimeGraphEntry entry2 = timegraph.getEntry(pg, "Head3");
    assertNotNull(entry1);
    assertNotNull(entry2);
    ITimeDataProvider timeprovider = timegraph.widget.getTimeDataProvider();
    // initial settings
    long unsetTime = 0;
    long time0 = 20;
    long time1 = 100;
    // Bookmark Range
    long bookmarkBegin = 40;
    long bookmarkEnd = 80;
    // Other marker
    long previousMarker = 38;
    long nextMarker = 44;
    Point down = entry1.getPointForTime(bookmarkBegin);
    Point up = entry2.getPointForTime(bookmarkEnd);
    validateRanges(timeprovider, unsetTime, unsetTime, time0, time1);
    fTimeGraph.drag(down, up, SWT.BUTTON1);
    // Contiguous time?
    validateRanges(timeprovider, bookmarkBegin, bookmarkEnd, time0, time1);
    fViewBot.toolbarButton("Add Bookmark...").click();
    SWTBotShell bookmarkShell = fBot.shell("Add Bookmark");
    bookmarkShell.bot().text().setText("Bookmark");
    bookmarkShell.bot().button(OK_BUTTON).click();
    fViewBot.toolbarButton("Previous Marker").click();
    validateRanges(timeprovider, previousMarker, previousMarker, time0, time1);
    fViewBot.toolbarButton("Next Marker").click();
    validateRanges(timeprovider, bookmarkBegin, bookmarkEnd, time0, time1);
    fViewBot.toolbarButton("Remove Bookmark").click();
    validateRanges(timeprovider, bookmarkBegin, bookmarkEnd, time0, time1);
    fViewBot.toolbarButton("Previous Marker").click();
    validateRanges(timeprovider, previousMarker, previousMarker, time0, time1);
    fViewBot.toolbarButton("Next Marker").click();
    validateRanges(timeprovider, nextMarker, nextMarker, time0, time1);
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) ITimeDataProvider(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.ITimeDataProvider) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) Point(org.eclipse.swt.graphics.Point) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test)

Example 10 with SWTBotTimeGraphEntry

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

the class TimeGraphViewTest method testDrag.

/**
 * Test Mouse operations, drag, select and middle-drag
 */
@Test
public void testDrag() {
    String pg = "Plumber guy";
    SWTBotTimeGraph timegraph = fTimeGraph;
    resetTimeRange();
    SWTBotTimeGraphEntry[] entries = timegraph.getEntries();
    assertNotNull(entries);
    SWTBotTimeGraphEntry entry1 = timegraph.getEntry(pg, "Hat2");
    assertNotNull(entry1);
    SWTBotTimeGraphEntry entry2 = timegraph.getEntry(pg, "Head3");
    assertNotNull(entry2);
    ITimeDataProvider timeprovider = timegraph.widget.getTimeDataProvider();
    validateRanges(timeprovider, 0, 0, 20, 100);
    // Change selection
    Point down = entry1.getPointForTime(40);
    Point up = entry2.getPointForTime(80);
    fTimeGraph.drag(down, up, SWT.BUTTON1);
    validateRanges(timeprovider, 40, 80, 20, 100);
    // Zoom window
    down = entry1.getPointForTime(70);
    up = entry2.getPointForTime(30);
    fTimeGraph.drag(down, up, SWT.BUTTON3);
    validateRanges(timeprovider, 40, 80, 30, 70);
    // Drag window
    down = entry1.getPointForTime(65);
    up = entry2.getPointForTime(35);
    fTimeGraph.drag(down, up, SWT.BUTTON2);
    validateRanges(timeprovider, 40, 80, 60, 100);
    // Check for aliasing
    up = entry1.getPointForTime(99);
    for (int selectionDown = 61; selectionDown < 99; selectionDown++) {
        down = entry1.getPointForTime(selectionDown);
        fTimeGraph.drag(down, up, SWT.BUTTON1);
        validateRanges(timeprovider, selectionDown, 99, 60, 100);
    }
    down = entry1.getPointForTime(61);
    for (int selectionUp = 62; selectionUp < 100; selectionUp++) {
        // drag the cursor by one ns per cycle
        up = entry1.getPointForTime(selectionUp);
        fTimeGraph.drag(down, up, SWT.BUTTON1);
        down = up;
        validateRanges(timeprovider, 61, selectionUp, 60, 100);
    }
    // drag cursor around
    down = entry1.getPointForTime(65);
    up = entry1.getPointForTime(85);
    fTimeGraph.drag(down, up, SWT.BUTTON1);
    validateRanges(timeprovider, 65, 85, 60, 100);
    up = entry1.getPointForTime(70);
    fTimeGraph.drag(down, up, SWT.BUTTON1);
    validateRanges(timeprovider, 70, 85, 60, 100);
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) ITimeDataProvider(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.ITimeDataProvider) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point) 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