Search in sources :

Example 1 with HistogramView

use of org.eclipse.tracecompass.tmf.ui.views.histogram.HistogramView in project tracecompass by tracecompass.

the class ImportAndReadKernelSmokeTest method testHV.

private void testHV(IViewPart vp) {
    SWTBotView hvBot = (new SWTWorkbenchBot()).viewById(HistogramView.ID);
    List<SWTBotToolbarButton> hvTools = hvBot.getToolbarButtons();
    for (SWTBotToolbarButton hvTool : hvTools) {
        if (hvTool.getToolTipText().toLowerCase().contains("lost")) {
            hvTool.click();
        }
    }
    HistogramView hv = (HistogramView) vp;
    final TmfSelectionRangeUpdatedSignal signal = new TmfSelectionRangeUpdatedSignal(hv, fDesired1.getTimestamp());
    final TmfSelectionRangeUpdatedSignal signal2 = new TmfSelectionRangeUpdatedSignal(hv, fDesired2.getTimestamp());
    hvBot.close();
    hv = (HistogramView) UIThreadRunnable.syncExec(() -> {
        try {
            return (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(HistogramView.ID));
        } catch (PartInitException e) {
        // Do nothing, returning null fails
        }
        return null;
    });
    assertNotNull(hv);
    hvBot = (new SWTWorkbenchBot()).viewById(HistogramView.ID);
    hv.updateTimeRange(100000);
    WaitUtils.waitForJobs();
    hv.selectionRangeUpdated(signal);
    hv.broadcast(signal);
    WaitUtils.waitForJobs();
    SWTBotUtils.delay(1000);
    hv.updateTimeRange(1000000000);
    WaitUtils.waitForJobs();
    hv.selectionRangeUpdated(signal2);
    hv.broadcast(signal2);
    WaitUtils.waitForJobs();
    SWTBotUtils.delay(1000);
    assertNotNull(hv);
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) PartInitException(org.eclipse.ui.PartInitException) HistogramView(org.eclipse.tracecompass.tmf.ui.views.histogram.HistogramView) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton)

Example 2 with HistogramView

use of org.eclipse.tracecompass.tmf.ui.views.histogram.HistogramView in project tracecompass by tracecompass.

the class AbstractImportAndReadSmokeTest method testHistogramView.

/**
 * Verifies the Histogram View
 *
 * @param vp
 *            the view part
 * @param tmfEd
 *            the events editor
 */
protected void testHistogramView(IViewPart vp, final TmfEventsEditor tmfEd) {
    final CtfTmfEvent desiredEvent1 = getEvent(100);
    UIThreadRunnable.syncExec(new VoidResult() {

        @Override
        public void run() {
            tmfEd.setFocus();
            tmfEd.selectionChanged(new SelectionChangedEvent(tmfEd, new StructuredSelection(desiredEvent1)));
        }
    });
    WaitUtils.waitForJobs();
    SWTBotUtils.delay(1000);
    final CtfTmfEvent desiredEvent2 = getEvent(10000);
    SWTBotView hvBot = fBot.viewById(HistogramView.ID);
    List<SWTBotToolbarButton> hvTools = hvBot.getToolbarButtons();
    for (SWTBotToolbarButton hvTool : hvTools) {
        if (hvTool.getToolTipText().toLowerCase().contains("lost")) {
            hvTool.click();
        }
    }
    HistogramView hv = (HistogramView) vp;
    final TmfSelectionRangeUpdatedSignal signal = new TmfSelectionRangeUpdatedSignal(hv, desiredEvent1.getTimestamp());
    final TmfSelectionRangeUpdatedSignal signal2 = new TmfSelectionRangeUpdatedSignal(hv, desiredEvent2.getTimestamp());
    hv.updateTimeRange(100000);
    WaitUtils.waitForJobs();
    hv.selectionRangeUpdated(signal);
    hv.broadcast(signal);
    WaitUtils.waitForJobs();
    SWTBotUtils.delay(1000);
    hv.updateTimeRange(1000000000);
    WaitUtils.waitForJobs();
    hv.selectionRangeUpdated(signal2);
    hv.broadcast(signal2);
    WaitUtils.waitForJobs();
    SWTBotUtils.delay(1000);
    assertNotNull(hv);
}
Also used : CtfTmfEvent(org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent) VoidResult(org.eclipse.swtbot.swt.finder.results.VoidResult) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) HistogramView(org.eclipse.tracecompass.tmf.ui.views.histogram.HistogramView) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton)

Aggregations

SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)2 SWTBotToolbarButton (org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton)2 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)2 HistogramView (org.eclipse.tracecompass.tmf.ui.views.histogram.HistogramView)2 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)1 VoidResult (org.eclipse.swtbot.swt.finder.results.VoidResult)1 CtfTmfEvent (org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent)1 PartInitException (org.eclipse.ui.PartInitException)1