Search in sources :

Example 16 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class CtfTmfExperimentTrimmingTest method setup.

/**
 * Test setup
 */
@Before
public void setup() {
    WaitUtils.waitForJobs();
    SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME);
    tracesFolder.contextMenu().menu("Open As Experiment...", "Generic Experiment").click();
    SWTBotUtils.activateEditor(fBot, "Experiment");
    SWTBotTreeItem project = SWTBotUtils.selectProject(fBot, PROJECT_NAME);
    SWTBotTreeItem experimentItem = SWTBotUtils.getTraceProjectItem(fBot, project, "Experiments", "Experiment");
    experimentItem.select();
    TmfTraceManager traceManager = TmfTraceManager.getInstance();
    ITmfTrace trace = traceManager.getActiveTrace();
    assertTrue(String.valueOf(trace), trace instanceof TmfExperiment);
    TmfExperiment experiment = (TmfExperiment) trace;
    assertNotNull(experiment);
    ITmfProjectModelElement elem = TmfProjectRegistry.findElement(experiment.getResource(), true);
    assertTrue(elem instanceof TmfExperimentElement);
    fOriginalExperiment = experiment;
    TmfTimeRange traceCutRange = getTraceCutRange(experiment);
    assertNotNull(traceCutRange);
    fRequestedTraceCutRange = traceCutRange;
    ITmfTimestamp requestedTraceCutEnd = traceCutRange.getEndTime();
    ITmfTimestamp requestedTraceCutStart = traceCutRange.getStartTime();
    assertTrue(experiment.getTimeRange().contains(traceCutRange));
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, requestedTraceCutStart, requestedTraceCutEnd, experiment));
    experimentItem.contextMenu("Export Time Selection as New Trace...").click();
    SWTBotShell shell = fBot.shell("Export trace section to...").activate();
    SWTBot dialogBot = shell.bot();
    assertEquals("Experiment", dialogBot.text().getText());
    dialogBot.text().setText("Experiment-trimmed");
    dialogBot.button("OK").click();
    SWTBotEditor newExperiment = fBot.editorByTitle("Experiment-trimmed");
    newExperiment.setFocus();
    fNewExperiment = traceManager.getActiveTrace();
    assertNotNull("No active trace", fNewExperiment);
    assertEquals("Incorrect active trace", "Experiment-trimmed", fNewExperiment.getName());
    WaitUtils.waitForJobs();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) SWTBotEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor) TmfTraceManager(org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager) ITmfProjectModelElement(org.eclipse.tracecompass.tmf.ui.project.model.ITmfProjectModelElement) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfExperimentElement(org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Before(org.junit.Before)

Example 17 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class TimeGraphViewTest method testZoomToSelection.

/**
 * Test zoom to selection
 */
@Test
public void testZoomToSelection() {
    resetTimeRange();
    SWTBotTimeGraph timegraph = fTimeGraph;
    TimeGraphViewStub view = getView();
    timegraph.setFocus();
    assertEquals(80, getDuration(view.getWindowRange()));
    /* set selection to trace start time */
    ITmfTimestamp selStartTime = TmfTimestamp.fromNanos(30L);
    ITmfTimestamp selEndTime = TmfTimestamp.fromNanos(80L);
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, selStartTime, selEndTime));
    timeGraphIsReadyCondition(new TmfTimeRange(selStartTime, selEndTime));
    fireKeyInGraph(timegraph, 'z');
    fViewBot.bot().waitUntil(new WindowRangeCondition(view, 50));
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 18 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class XYChartViewTest method testZoomToSelection.

/**
 * Test zoom to selection
 */
@Test
public void testZoomToSelection() {
    SWTBotEclipseSwtChart xyChart = new SWTBotEclipseSwtChart(fViewBot.bot());
    xyChart.setFocus();
    assertEquals(80, fXyViewer.getWindowDuration());
    /* set selection to trace start time */
    ITmfTimestamp selStartTime = TmfTimestamp.fromNanos(30L);
    ITmfTimestamp selEndTime = TmfTimestamp.fromNanos(80L);
    TmfTimeRange range = new TmfTimeRange(selStartTime, selEndTime);
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, selStartTime, selEndTime));
    // Wait till selection is finished
    fViewBot.bot().waitUntil(new DefaultCondition() {

        @Override
        public boolean test() throws Exception {
            return (fXyViewer.getSelectionEndTime() - fXyViewer.getSelectionBeginTime()) == getDuration(range);
        }

        @Override
        public String getFailureMessage() {
            return "SWT Chart is null";
        }
    });
    fireKeyInGraph(xyChart, 'z');
    fViewBot.bot().waitUntil(new SeriesCondition(fXyViewer, getDuration(range)));
}
Also used : SWTBotEclipseSwtChart(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotEclipseSwtChart) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) DefaultCondition(org.eclipse.swtbot.swt.finder.waits.DefaultCondition) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) Test(org.junit.Test)

Example 19 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoaderSignalTest method setUpClass.

/**
 * Initialization
 */
@BeforeClass
public static void setUpClass() {
    fFacility = Uml2SDTestFacility.getInstance();
    fFacility.init();
    fFacility.selectExperiment();
    range = new TmfTimeRange(new Uml2SDTestTimestamp(9789689220871L), new Uml2SDTestTimestamp(9789773881426L));
    // Get range window for tests below
    rangeWindow = (TmfTimestamp) range.getEndTime().getDelta(range.getStartTime());
    TmfTimestamp currentTime = new Uml2SDTestTimestamp(9789773782043L);
    fFacility.getTrace().broadcast(new TmfWindowRangeUpdatedSignal(fFacility, range));
    fFacility.getTrace().broadcast(new TmfSelectionRangeUpdatedSignal(fFacility, currentTime));
    fFacility.delay(IUml2SDTestConstants.BROADCAST_DELAY);
    fTmfComponent = new Uml2SDSignalValidator();
}
Also used : TmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) BeforeClass(org.junit.BeforeClass)

Example 20 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoaderTimeTest method verifySynchToTimeFirst.

/**
 * Test Case: 007
 * Description: Verify synchToTime (timestamp of first message in page)
 * Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
 * Expected result: Move to correct page, selection of last message in page.
 */
@Test
public void verifySynchToTimeFirst() {
    fFacility.getTrace().broadcast(new TmfSelectionRangeUpdatedSignal(this, TC_007_TIME_VALUE));
    fFacility.getLoader().waitForCompletion();
    fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
    assertEquals("synchToTime", TC_007_PAGE_VALUE, fFacility.getLoader().currentPage());
    selection = fFacility.getSdView().getSDWidget().getSelection();
    assertNotNull("synchToTime", selection);
    msg = (TmfSyncMessage) selection.get(0);
    assertEquals("synchToTime", 1, selection.size());
    assertEquals("synchToTime", TC_007_START_OCCURRANCE, msg.getStartOccurrence());
    assertEquals("synchToTime", TC_007_END_OCCURRANCE, msg.getEndOccurrence());
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) Test(org.junit.Test)

Aggregations

TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)41 Test (org.junit.Test)22 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)18 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)11 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)11 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)11 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)9 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)5 Action (org.eclipse.jface.action.Action)4 IAction (org.eclipse.jface.action.IAction)4 Point (org.eclipse.swt.graphics.Point)3 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)3 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)3 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)3 ISelection (org.eclipse.jface.viewers.ISelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)2 DefaultCondition (org.eclipse.swtbot.swt.finder.waits.DefaultCondition)2 SWTBotCheckBox (org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox)2 SWTBotTable (org.eclipse.swtbot.swt.finder.widgets.SWTBotTable)2