Search in sources :

Example 11 with AbstractTimeGraphView

use of org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView in project tracecompass by tracecompass.

the class FlameChartViewTest method goToTime.

private static void goToTime(long timestamp) {
    ITmfTimestamp time = TmfTimestamp.fromNanos(timestamp);
    SWTBotTable table = sfBot.activeEditor().bot().table();
    table.setFocus();
    WaitUtils.waitForJobs();
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(table.widget, time));
    sfBot.waitUntil(ConditionHelpers.selectionInEventsTable(sfBot, timestamp));
    final SWTBotView viewBot = sfBot.viewById(FlameChartView.ID);
    IWorkbenchPart part = viewBot.getViewReference().getPart(false);
    sfBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) part, new TmfTimeRange(time, time), time));
}
Also used : AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) SWTBotTable(org.eclipse.swtbot.swt.finder.widgets.SWTBotTable) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)

Example 12 with AbstractTimeGraphView

use of org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView in project tracecompass by tracecompass.

the class PinAndCloneTest method testFollow.

/**
 * Test the follow time updates functionality
 */
@Test
public void testFollow() {
    TmfTraceManager traceManager = TmfTraceManager.getInstance();
    ITmfTrace ust = traceManager.getActiveTrace();
    assertNotNull(ust);
    ITmfTrace kernelTest = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.CONTEXT_SWITCHES_KERNEL);
    SWTBotUtils.openTrace(TRACE_PROJECT_NAME, kernelTest.getPath(), TRACETYPE_ID);
    /* Finish waiting for the trace to index */
    WaitUtils.waitForJobs();
    SWTBotEditor kernelEditor = SWTBotUtils.activateEditor(fBot, kernelTest.getName());
    // wait for the editor to be ready.
    fBot.editorByTitle(kernelTest.getName());
    ITmfTrace kernel = traceManager.getActiveTrace();
    assertNotNull(kernel);
    SWTBotTable kernelEventTable = kernelEditor.bot().table();
    SWTBotTableItem kernelEvent = kernelEventTable.getTableItem(5);
    kernelEvent.contextMenu(FOLLOW_TIME_UPDATES_FROM_OTHER_TRACES).click();
    SWTBotUtils.activateEditor(fBot, ust.getName());
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, RANGE, ust));
    // assert that the kernel trace followed the ust trace's range
    IWorkbenchPart part = fOriginalViewBot.getViewReference().getPart(false);
    assertTrue(part instanceof AbstractTimeGraphView);
    AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part;
    fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, ust, RANGE));
    SWTBotUtils.activateEditor(fBot, kernel.getName());
    fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, kernel, RANGE));
    // unfollow (don't use context menu on table item to avoid updating selection)
    kernelEventTable.contextMenu(FOLLOW_TIME_UPDATES_FROM_OTHER_TRACES).click();
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, ust.getInitialTimeRange(), ust));
    fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, kernel, RANGE));
    kernelTest.dispose();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) SWTBotEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor) AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) TmfTraceManager(org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) SWTBotTable(org.eclipse.swtbot.swt.finder.widgets.SWTBotTable) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) SWTBotTableItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem) Test(org.junit.Test)

Example 13 with AbstractTimeGraphView

use of org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView in project tracecompass by tracecompass.

the class PinAndCloneTest method testCloneSingleTrace.

/**
 * Test the cloning feature.
 */
@Test
public void testCloneSingleTrace() {
    // single trace.
    SWTBotMenu cloneMenu = fOriginalViewBot.viewMenu().menu(NEW_VIEW_MENU);
    /*
         * assert that the original editor was not renamed and that the cloned one
         * exists and is pinned to the UST trace.
         */
    cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName()).click();
    assertOriginalViewTitle(TIME_GRAPH_VIEW_TITLE);
    SWTBotView clonedView = fBot.viewByTitle(PINNED_TO_UST_TIME_GRAPH_VIEW_TITLE);
    assertEquals("Should not have created a new instance", 1, fBot.editors().size());
    clonedView.close();
    /*
         * Assert that a new instance is created.
         */
    cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName() + " | new instance").click();
    assertOriginalViewTitle(TIME_GRAPH_VIEW_TITLE);
    clonedView = fBot.viewByTitle(PINNED_TO_UST_TIME_GRAPH_VIEW_TITLE2);
    assertEquals("Should have created a new instance", 2, fBot.editors().size());
    SWTBotEditor cloneEditor = fBot.editorByTitle(fUstTestTrace.getName() + CLONED_TRACE_SUFFIX);
    // Get the window range of the cloned trace
    TmfTraceManager traceManager = TmfTraceManager.getInstance();
    ITmfTrace cloneTrace = traceManager.getActiveTrace();
    assertNotNull(cloneTrace);
    // go back to original trace, pin it
    SWTBotUtils.activateEditor(fBot, fUstTestTrace.getName());
    fOriginalViewBot.toolbarButton(PIN_VIEW_BUTTON_NAME).click();
    ITmfTrace ust = traceManager.getActiveTrace();
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, RANGE, ust));
    // assert that the cloned trace's window range did not change
    SWTBotUtils.activateEditor(fBot, cloneTrace.getName() + CLONED_TRACE_SUFFIX);
    IWorkbenchPart part = clonedView.getViewReference().getPart(false);
    assertTrue(part instanceof AbstractTimeGraphView);
    AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part;
    fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, cloneTrace, INITIAL_UST_RANGE));
    cloneEditor.close();
}
Also used : SWTBotEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) TmfTraceManager(org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) Test(org.junit.Test)

Example 14 with AbstractTimeGraphView

use of org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView in project tracecompass by tracecompass.

the class MarkerSetSwtBotTest method testNavigateBetweenMarkers.

/**
 * Test navigation between markers
 */
@Test
public void testNavigateBetweenMarkers() {
    AbstractTimeGraphView part = (AbstractTimeGraphView) fViewBot.getViewReference().getPart(false);
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, fFullRange));
    fBot.waitUntil(ConditionHelpers.windowRange(fFullRange));
    insertContent();
    fViewBot.setFocus();
    SWTBotRootMenu viewMenu = fViewBot.viewMenu();
    viewMenu.menu("Marker Set", "Set A").click();
    fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition(part, new TmfTimeRange(TmfTimestamp.fromNanos(fStart), TmfTimestamp.fromNanos(fStart)), TmfTimestamp.fromNanos(fStart)));
    fViewBot.toolbarButton("Next Marker").click();
    // Marker A-1: period = 10, unit = ns, offset = 0
    long period = 10l;
    long nextStart = fStart + (period - (fStart % period));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TmfTimestamp.fromNanos(nextStart), TmfTimestamp.fromNanos(nextStart + period))));
    viewMenu.menu("Show Markers", "Marker A-1").hide();
    fViewBot.toolbarButton("Previous Marker").click();
    fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition(part, new TmfTimeRange(TmfTimestamp.fromNanos(fStart), TmfTimestamp.fromNanos(nextStart)), TmfTimestamp.fromNanos(fStart)));
    removeContent();
}
Also used : AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) SWTBotRootMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Aggregations

AbstractTimeGraphView (org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView)14 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)11 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)7 Test (org.junit.Test)7 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)6 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)4 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)4 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)3 SWTBotTable (org.eclipse.swtbot.swt.finder.widgets.SWTBotTable)3 TmfTraceManager (org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager)3 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)3 SWTBotTableItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem)2 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)2 Before (org.junit.Before)2 File (java.io.File)1 Point (org.eclipse.swt.graphics.Point)1 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)1 DefaultCondition (org.eclipse.swtbot.swt.finder.waits.DefaultCondition)1 SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)1 SWTBotRootMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu)1