Search in sources :

Example 6 with SWTBotTimeGraph

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

the class ResourcesViewTest method testAddRemoveBookmark.

/**
 * Test tool bar button "Add Bookmark..." and "Remove Bookmark"
 */
@Test
public void testAddRemoveBookmark() {
    SWTBotView viewBot = getViewBot();
    /* 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));
    fBot.waitUntil(ConditionHelpers.windowRange(range));
    /* set selection to trace start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);
    /* set focus on time graph */
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    timeGraph.setFocus();
    /* select first CPU resource */
    timeGraph.getEntry(LttngTraceGenerator.getName(), CPU0_THREADS).select();
    /* click "Select Next State Change" 2 times */
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME1, CPU0_TIME1), CPU0_TIME1);
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME2, CPU0_TIME2), CPU0_TIME2);
    /* click "Add Bookmark..." and fill Add Bookmark dialog */
    viewBot.toolbarButton(ADD_BOOKMARK).click();
    SWTBot dialogBot = fBot.shell(ADD_BOOKMARK_DIALOG).bot();
    dialogBot.text().setText("B1");
    dialogBot.button(OK).click();
    /*
         * click "Select Next State Change" 2 times and shift-click "Select Next
         * State Change
         */
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME3, CPU0_TIME3), CPU0_TIME3);
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME4), CPU0_TIME4);
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5);
    /* click "Add Bookmark..." and fill Add Bookmark dialog */
    viewBot.toolbarButton(ADD_BOOKMARK).click();
    dialogBot = fBot.shell(ADD_BOOKMARK_DIALOG).bot();
    dialogBot.text().setText("B2");
    dialogBot.button(OK).click();
    /* click "Previous Marker" */
    viewBot.toolbarButton(PREVIOUS_MARKER).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME2, CPU0_TIME2), CPU0_TIME2);
    /* click "Remove Bookmark" */
    viewBot.toolbarButton(REMOVE_BOOKMARK).click();
    /* click "Next Marker" */
    viewBot.toolbarButton(NEXT_MARKER).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5);
    /* click "Remove Bookmark" */
    viewBot.toolbarButton(REMOVE_BOOKMARK).click();
    /* click "Previous Marker" */
    viewBot.toolbarButton(PREVIOUS_MARKER).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5);
    /* click "Select Previous State Change" */
    viewBot.toolbarButton(SELECT_PREVIOUS_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME4), CPU0_TIME4);
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 7 with SWTBotTimeGraph

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

the class ResourcesViewTest method testNextPreviousMarker.

private void testNextPreviousMarker(Runnable nextMarker, Runnable shiftNextMarker, Runnable previousMarker, Runnable shiftPreviousMarker) {
    SWTBotView viewBot = getViewBot();
    /* set selection to trace start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);
    /* set focus on time graph */
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    timeGraph.setFocus();
    /* select first item */
    timeGraph.getEntry(LttngTraceGenerator.getName()).select();
    /* click "Next Marker" 3 times */
    nextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1);
    nextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME2, LOST_EVENT_END2), LOST_EVENT_TIME2);
    nextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END3), LOST_EVENT_TIME3);
    /* shift-click "Previous Marker" 3 times */
    shiftPreviousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME3), LOST_EVENT_TIME3);
    shiftPreviousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME2), LOST_EVENT_TIME2);
    shiftPreviousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME1), LOST_EVENT_TIME1);
    /* shift-click "Next Marker" 3 times */
    shiftNextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END1), LOST_EVENT_END1);
    shiftNextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END2), LOST_EVENT_END2);
    shiftNextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END3), LOST_EVENT_END3);
    /* click "Previous Marker" 3 times */
    previousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME2, LOST_EVENT_END2), LOST_EVENT_TIME2);
    previousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1);
    previousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1);
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)

Example 8 with SWTBotTimeGraph

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

the class TimeGraphViewUiContextTestBase method testHideEmptyRowsState.

/**
 * Test Hide Empty Rows filter state persistence.
 */
@Test
public void testHideEmptyRowsState() {
    // Select editor
    SWTBotTimeGraph timegraphBot = new SWTBotTimeGraph(getViewBot().bot());
    SWTBotUtils.activateEditor(fBot, BUG446190);
    SWTBotUtils.waitUntil(root -> timegraphBot.getEntries()[0].getText().equals(root), BUG446190, "Failed to activate editor " + BUG446190);
    // expand all entries
    timegraphBot.expandAll();
    int count = getVisibleItems(timegraphBot);
    SWTBotToolbarToggleButton button = getViewBot().toolbarToggleButton(HIDE_EMPTY_ROWS);
    button.click();
    assertTrue(button.isChecked());
    /* Verify that number active entries changed */
    SWTBotUtils.waitUntil(graph -> getVisibleItems(graph) < count, timegraphBot, () -> "More number of visible entries expected: (count: " + count + ", actual: " + getVisibleItems(timegraphBot) + ")");
    // Switch trace
    SWTBotUtils.activateEditor(fBot, FLIPPING_ENDIANNESS);
    SWTBotUtils.waitUntil(root -> timegraphBot.getEntries()[0].getText().equals(root), FLIPPING_ENDIANNESS, "Failed to activate editor " + FLIPPING_ENDIANNESS);
    button = getViewBot().toolbarToggleButton(HIDE_EMPTY_ROWS);
    assertFalse(button.isChecked());
    // Switch trace
    SWTBotUtils.activateEditor(fBot, BUG446190);
    SWTBotUtils.waitUntil(root -> timegraphBot.getEntries()[0].getText().equals(root), BUG446190, "Failed to activate editor " + FLIPPING_ENDIANNESS);
    button = getViewBot().toolbarToggleButton(HIDE_EMPTY_ROWS);
    assertTrue(button.isChecked());
    /* Verify that number active entries changed */
    SWTBotUtils.waitUntil(graph -> getVisibleItems(graph) < count, timegraphBot, () -> "More number of visible entries expected: (count: " + count + ", actual: " + getVisibleItems(timegraphBot) + ")");
    button = getViewBot().toolbarToggleButton(HIDE_EMPTY_ROWS);
    button.click();
    assertFalse(button.isChecked());
    /* Verify that number active entries changed */
    SWTBotUtils.waitUntil(graph -> getVisibleItems(graph) == count, timegraphBot, () -> "More number of visible entries expected: (count: " + count + ", actual: " + getVisibleItems(timegraphBot) + ")");
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotToolbarToggleButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarToggleButton) Test(org.junit.Test)

Example 9 with SWTBotTimeGraph

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

the class XmlTimegraphViewTest method getTimegraph.

private static SWTBotTimeGraph getTimegraph() {
    SWTBotView viewBot = fBot.viewById(XmlTimeGraphView.ID);
    SWTBotTimeGraph timegraph = new SWTBotTimeGraph(viewBot.bot());
    assertTrue("timegraph visible", timegraph.isVisible());
    timegraph.setFocus();
    return timegraph;
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)

Example 10 with SWTBotTimeGraph

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

the class FlameChartViewTest method testGoToTimeAndCheckStackWithNames.

/**
 * Test check callstack at a time with function map
 *
 * @throws IOException
 *             Missing file
 */
@Test
public void testGoToTimeAndCheckStackWithNames() throws IOException {
    goToTime(TIMESTAMPS[0]);
    final SWTBotView viewBot = sfBot.viewById(FlameChartView.ID);
    viewBot.setFocus();
    URL mapUrl = CtfTmfTestTraceUtils.class.getResource("cyg-profile-mapping.txt");
    String absoluteFile = FileLocator.toFileURL(mapUrl).getFile();
    TmfFileDialogFactory.setOverrideFiles(absoluteFile);
    SWTBotShell shell = openSymbolProviderDialog();
    SWTBot shellBot = shell.bot();
    shellBot.button("Add...").click();
    shellBot.button("OK").click();
    shellBot.waitUntil(Conditions.shellCloses(shell));
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    SWTBotTimeGraphEntry[] threads = timeGraph.getEntry(TRACE, PROCESS).getEntries();
    assertEquals(1, threads.length);
    assertEquals(THREAD, threads[0].getText(0));
    waitForSymbolNames("main", "event_loop", "handle_event");
}
Also used : SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) URL(java.net.URL) Test(org.junit.Test)

Aggregations

SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)38 Test (org.junit.Test)31 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)17 SWTBotTimeGraphEntry (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry)16 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)13 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)13 Point (org.eclipse.swt.graphics.Point)10 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)9 Rectangle (org.eclipse.swt.graphics.Rectangle)8 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)8 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)7 ImageHelper (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ImageHelper)6 RGB (org.eclipse.swt.graphics.RGB)5 SWTBotText (org.eclipse.swtbot.swt.finder.widgets.SWTBotText)5 ArrayList (java.util.ArrayList)4 NonNull (org.eclipse.jdt.annotation.NonNull)4 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)4 IOException (java.io.IOException)3 List (java.util.List)3 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)3