Search in sources :

Example 1 with TmfWindowRangeUpdatedSignal

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

the class NewCounterViewPinAndCloneTest method testCloneSingleTrace.

/**
 * Test the cloning feature.
 */
@Test
public void testCloneSingleTrace() {
    SWTBotView originalViewBot = getSWTBotView();
    SWTBotMenu cloneMenu = originalViewBot.viewMenu().menu(NEW_COUNTER_STACK_MENU);
    /*
         * Assert that the original editor was not renamed and that the cloned one
         * exists and is pinned to the kernel_vm trace.
         */
    cloneMenu.menu(PINNED_TO_PREFIX + getTestTrace().getName()).click();
    assertOriginalViewTitle(COUNTERS_VIEW_TITLE);
    SWTBotView clonedView = fBot.viewByTitle(PINNED_TO_TRACE_COUNTERS_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 + getTestTrace().getName() + " | new instance").click();
    assertOriginalViewTitle(COUNTERS_VIEW_TITLE);
    clonedView = fBot.viewByTitle(CLONED_VIEW_TITLE_NAME);
    assertEquals("Should have created a new instance", 2, fBot.editors().size());
    SWTBotEditor cloneEditor = fBot.editorByTitle(getTestTrace().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, getTestTrace().getName());
    originalViewBot.toolbarButton(PIN_VIEW_BUTTON_NAME).click();
    // Assert that the cloned trace's window range did not change
    SWTBotUtils.activateEditor(fBot, cloneTrace.getName() + CLONED_TRACE_SUFFIX);
    IViewPart viewPart = clonedView.getViewReference().getView(false);
    assertTrue(viewPart instanceof TmfChartView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, RANGE, getTestTrace()));
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    SWTBotUtils.waitUntil(v -> (v.getWindowStartTime() == KERNEL_START && v.getWindowEndTime() == KERNEL_INITIAL_END), chartViewer, "Range of cloned view changed");
    cloneEditor.close();
}
Also used : SWTBotEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfTraceManager(org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager) IViewPart(org.eclipse.ui.IViewPart) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) TmfChartView(org.eclipse.tracecompass.tmf.ui.views.xychart.TmfChartView) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) TmfCommonXAxisChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) Test(org.junit.Test) XYDataProviderBaseTest(org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)

Example 2 with TmfWindowRangeUpdatedSignal

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

the class NewCounterViewPinAndCloneTest method testPinTwoTraces.

/**
 * Test the behavior with two traces.
 */
@Test
public void testPinTwoTraces() {
    SWTBotView originalViewBot = getSWTBotView();
    ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace();
    assertNotNull(activeTrace);
    ITmfTrace kernelTestTrace = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.CONTEXT_SWITCHES_KERNEL);
    SWTBotUtils.openTrace(TRACE_PROJECT_NAME, kernelTestTrace.getPath(), TRACETYPE_ID);
    // / Finish waiting for the trace to index
    WaitUtils.waitForJobs();
    // wait for the editor to be ready.
    fBot.editorByTitle(kernelTestTrace.getName());
    // Assert that the pin to drop down menuItems are present for both traces.
    fBot.waitUntil(new DefaultCondition() {

        WidgetNotFoundException fException;

        @Override
        public boolean test() throws Exception {
            try {
                SWTBotToolbarDropDownButton toolbarDropDownButton = originalViewBot.toolbarDropDownButton(PIN_VIEW_BUTTON_NAME);
                toolbarDropDownButton.menuItem(PIN_TO_PREFIX + kernelTestTrace.getName());
                toolbarDropDownButton.menuItem(PIN_TO_PREFIX + getTestTrace().getName()).click();
                return true;
            } catch (WidgetNotFoundException e) {
                fException = e;
                return false;
            }
        }

        @Override
        public String getFailureMessage() {
            return "Traces not available in toolbar drop down menu: " + fException;
        }
    });
    /*
         * Assert that the pinned view is the kernel_vm trace despite the active trace being
         * the context-switch trace.
         */
    assertOriginalViewTitle(PINNED_TO_TRACE_COUNTERS_VIEW_TITLE);
    activeTrace = TmfTraceManager.getInstance().getActiveTrace();
    assertNotNull("There should be an active trace", activeTrace);
    assertEquals("context-switches-kernel should be the active trace", kernelTestTrace.getName(), activeTrace.getName());
    // Get the window range of the kernel trace
    TmfTraceManager traceManager = TmfTraceManager.getInstance();
    ITmfTrace kernelTrace = traceManager.getActiveTrace();
    assertNotNull(kernelTrace);
    // Switch back and forth
    SWTBotUtils.activateEditor(fBot, getTestTrace().getName());
    assertOriginalViewTitle(PINNED_TO_TRACE_COUNTERS_VIEW_TITLE);
    SWTBotUtils.activateEditor(fBot, kernelTestTrace.getName());
    assertOriginalViewTitle(PINNED_TO_TRACE_COUNTERS_VIEW_TITLE);
    IViewPart viewPart = originalViewBot.getViewReference().getView(false);
    assertTrue(viewPart instanceof TmfChartView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, RANGE, kernelTrace));
    // Assert that the original views trace's window range did not change
    SWTBotUtils.activateEditor(fBot, getTestTrace().getName());
    SWTBotUtils.waitUntil(v -> (v.getWindowStartTime() == KERNEL_START && v.getWindowEndTime() == KERNEL_TEST_INITIAL_END), chartViewer, "Range of cloned view changed");
    // Unpin from active trace
    SWTBotUtils.activateEditor(fBot, kernelTrace.getName());
    originalViewBot.toolbarButton(UNPIN_VIEW_BUTTON_NAME).click();
    assertOriginalViewTitle(COUNTERS_VIEW_TITLE);
    originalViewBot.toolbarButton(PIN_VIEW_BUTTON_NAME).click();
    assertOriginalViewTitle(PINNED_TO_CTX_SWITCH_VIEW_TITLE);
    // Close the pinned trace
    SWTBotEditor kernelTable = fBot.editorByTitle(kernelTestTrace.getName());
    kernelTable.close();
    // Verify that view title is reset
    SWTBotUtils.waitUntil(v -> v.getReference().getPartName().equals(COUNTERS_VIEW_TITLE), originalViewBot, "View name didn't change");
    kernelTestTrace.dispose();
}
Also used : IViewPart(org.eclipse.ui.IViewPart) SWTBotToolbarDropDownButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) SWTBotEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) TmfTraceManager(org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager) TmfChartView(org.eclipse.tracecompass.tmf.ui.views.xychart.TmfChartView) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) DefaultCondition(org.eclipse.swtbot.swt.finder.waits.DefaultCondition) TmfCommonXAxisChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer) Test(org.junit.Test) XYDataProviderBaseTest(org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)

Example 3 with TmfWindowRangeUpdatedSignal

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

the class ControlFlowViewTest method testDynamicFiltersDialog.

/**
 * Test dynamic filters dialog
 */
@Test
public void testDynamicFiltersDialog() {
    String valid_cpu_ranges = "0,1,2-100";
    String invalid_cpu_ranges = "-1,1";
    /* 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);
    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);
    SWTBotRadio onCpuRadio = shell.bot().radio(DYNAMIC_FILTERS_ON_CPU_RADIO);
    SWTBotRadio allActiveRadio = shell.bot().radio(DYNAMIC_FILTERS_ALL_ACTIVE_RADIO);
    SWTBotText onCpuField = shell.bot().textWithMessage(DYNAMIC_FILTER_ON_CPU_FIELD_MESSAGE);
    assertFalse(activeThreadsCheckbox.isChecked());
    assertFalse(onCpuRadio.isEnabled());
    assertFalse(allActiveRadio.isEnabled());
    assertFalse(onCpuField.isEnabled());
    /*
         * Test Active Filter buttons toggle
         */
    activeThreadsCheckbox.click();
    /* All objects should be enabled except for the CPU ranges field */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertFalse(onCpuField.isEnabled());
    /*
         * The All Active Threads option should be the default for a new filter
         */
    assertTrue(allActiveRadio.isSelected());
    /*
         * Select All Threads on CPUs option
         */
    onCpuRadio.click();
    /* All objects should be enabled */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertTrue(onCpuField.isEnabled());
    assertFalse(allActiveRadio.isSelected());
    assertTrue(onCpuRadio.isSelected());
    /*
         * Select All Active Threads then Active Threads on CPUs to validate
         * toggle of options
         */
    allActiveRadio.click();
    /* All objects should be enabled except for the CPU ranges field */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertFalse(onCpuField.isEnabled());
    assertTrue(allActiveRadio.isSelected());
    assertFalse(onCpuRadio.isSelected());
    /* Select Active Threads on CPUs */
    onCpuRadio.click();
    /* All objects should be enabled */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertTrue(onCpuField.isEnabled());
    assertFalse(allActiveRadio.isSelected());
    assertTrue(onCpuRadio.isSelected());
    /* Put an invalid value in the CPU ranges field */
    onCpuField.setText(invalid_cpu_ranges);
    /* Make sure the OK button is not enabled when in an invalid state */
    assertFalse(shell.bot().button(DIALOG_OK).isEnabled());
    /* Put a valid value in the CPU ranges field */
    onCpuField.setText(valid_cpu_ranges);
    /* Make sure the OK button is enabled when in a valid state */
    assertTrue(shell.bot().button(DIALOG_OK).isEnabled());
    shell.bot().button(DIALOG_OK).click();
    timeGraphIsReadyCondition(range);
    /* Make sure that the quick Active Thread Filter toggle is checked */
    assertTrue(getViewBot().viewMenu(DYNAMIC_FILTER_ACTIVE_THREADS_ONLY_TOGGLE).isChecked());
    /* Make sure that the Flat presentation is checked */
    assertTrue(getViewBot().viewMenu(THREAD_PRESENTATION_FLAT).isChecked());
    assertFalse(getViewBot().viewMenu(THREAD_PRESENTATION_HIERARCHICAL).isChecked());
    /* Reopen the dialog */
    getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click();
    shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate();
    /* Make sure nothing is checked and radio buttons are disabled */
    activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX);
    onCpuRadio = shell.bot().radio(DYNAMIC_FILTERS_ON_CPU_RADIO);
    allActiveRadio = shell.bot().radio(DYNAMIC_FILTERS_ALL_ACTIVE_RADIO);
    onCpuField = shell.bot().textWithMessage(DYNAMIC_FILTER_ON_CPU_FIELD_MESSAGE);
    /* Make sure the previous settings are set correctly */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertTrue(onCpuField.isEnabled());
    assertFalse(allActiveRadio.isSelected());
    assertTrue(onCpuRadio.isSelected());
    assertTrue(onCpuField.isEnabled());
    assertEquals("CPU ranges not equal", onCpuField.getText(), valid_cpu_ranges);
    /*
         * Change to All Active Threads option click OK then reopen. The
         * previous CPU range should still be there.
         */
    allActiveRadio.click();
    /* Make sure that the ranges are still visible but disabled */
    assertFalse(onCpuField.isEnabled());
    assertEquals("Cpu ranges not equal", onCpuField.getText(), valid_cpu_ranges);
    /* Close the dialog */
    shell.bot().button(DIALOG_OK).click();
    timeGraphIsReadyCondition(range);
    /* Open the dialog */
    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);
    onCpuRadio = shell.bot().radio(DYNAMIC_FILTERS_ON_CPU_RADIO);
    allActiveRadio = shell.bot().radio(DYNAMIC_FILTERS_ALL_ACTIVE_RADIO);
    onCpuField = shell.bot().textWithMessage(DYNAMIC_FILTER_ON_CPU_FIELD_MESSAGE);
    /* Range field should have a value in it */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertFalse(onCpuField.isEnabled());
    assertTrue(allActiveRadio.isSelected());
    assertFalse(onCpuRadio.isSelected());
    assertFalse(onCpuField.isEnabled());
    assertEquals("CPU ranges not equal", onCpuField.getText(), valid_cpu_ranges);
    shell.bot().button(DIALOG_CANCEL).click();
}
Also used : SWTBotRadio(org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotCheckBox(org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText) 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 4 with TmfWindowRangeUpdatedSignal

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

the class ControlFlowViewTest method testToolBarFollowCPUForwardBackward.

/**
 * Test tool bar buttons "Follow CPU Forward" and "Follow CPU Backward"
 */
@Test
public void testToolBarFollowCPUForwardBackward() {
    /* 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));
    SWTBotView viewBot = getViewBot();
    /* set focus on time graph */
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    timeGraph.setFocus();
    /* select first thread */
    timeGraph.getEntry(LttngTraceGenerator.getName(), "gnuplot").select();
    /* click "Follow CPU Forward" 3 times */
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1));
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME1, TID2_TIME1));
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID2_TIME2)));
    fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "2"));
    assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME2));
    /* shift-click "Follow CPU Forward" 3 times */
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME3));
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4));
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID5_TIME1)));
    fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "5"));
    assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID5_TIME1));
    /* shift-click "Follow CPU Backward" 4 times */
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4));
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME3));
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME1));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID2_TIME1)));
    fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "2"));
    assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME1));
    /* click "Follow CPU Forward" 2 times */
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID2_TIME3)));
    fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "2"));
    assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME3));
    /* shift-click "Follow CPU Backward" 3 times */
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME2));
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME1));
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID1_TIME1));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID1_TIME1)));
    fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "1"));
    assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME1));
    /* shift-click "Follow CPU Forward" 4 times */
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME1));
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME2));
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3));
    viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME4));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID2_TIME4)));
    fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "2"));
    assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME4));
    /* click "Follow CPU Backward" 5 times */
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3));
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME1, TID2_TIME1));
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1));
    viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME)));
    assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(START_TIME));
}
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) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 5 with TmfWindowRangeUpdatedSignal

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

the class ControlFlowViewTest method testFilter.

/**
 * Test the filter
 */
@Test
public void testFilter() {
    /* change window range to 1 ms */
    TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(1000000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));
    SWTBotView viewBot = getViewBot();
    SWTBotToolbarButton filterButton = viewBot.toolbarButton("Show View Filters");
    filterButton.click();
    SWTBot bot = fBot.shell("Filter").activate().bot();
    SWTBotTree treeBot = bot.tree();
    // get how many items there are
    int checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals("default", 226, checked);
    // test "uncheck all button"
    bot.button(UNCHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(0, checked);
    // test check active
    bot.button(CHECK_ACTIVE).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_ACTIVE, 69, checked);
    // test check all
    bot.button(CHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_ALL, 226, checked);
    // test uncheck inactive
    bot.button(UNCHECK_INACTIVE).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(UNCHECK_INACTIVE, 69, checked);
    // test check selected
    treeBot.getTreeItem(LttngTraceGenerator.getName()).select("gnuplot");
    bot.button(UNCHECK_ALL).click();
    bot.button(CHECK_SELECTED).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_SELECTED, 2, checked);
    // test check subtree
    bot.button(UNCHECK_ALL).click();
    bot.button(CHECK_SUBTREE).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_SUBTREE, 2, checked);
    // test uncheck selected
    bot.button(CHECK_ALL).click();
    bot.button(UNCHECK_SELECTED).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(UNCHECK_SELECTED, 225, checked);
    // test uncheck subtree
    bot.button(CHECK_ALL).click();
    bot.button(UNCHECK_SUBTREE).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(UNCHECK_SELECTED, 225, checked);
    // test filter
    bot.button(UNCHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(0, checked);
    bot.text().setText("half-life 3");
    SWTBotTreeItem treeItem = treeBot.getTreeItem(LttngTraceGenerator.getName());
    treeItem.rowCount();
    fBot.waitUntil(ConditionHelpers.treeItemCount(treeItem, 25));
    bot.button(CHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals("Filtered", 26, checked);
    bot.button(DIALOG_OK).click();
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(getViewBot().bot());
    SWTBotTimeGraphEntry traceEntry = timeGraph.getEntry(LttngTraceGenerator.getName());
    for (SWTBotTimeGraphEntry entry : traceEntry.getEntries()) {
        assertEquals("Filtered Control flow view", "Half-life 3", entry.getText());
    }
}
Also used : SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) 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) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton) Test(org.junit.Test)

Aggregations

TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)31 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)25 Test (org.junit.Test)20 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)9 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)9 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)8 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)7 AbstractTimeGraphView (org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView)6 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)6 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)5 TmfTraceManager (org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager)5 XYDataProviderBaseTest (org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)5 TmfCommonXAxisChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer)5 IViewPart (org.eclipse.ui.IViewPart)5 Point (org.eclipse.swt.graphics.Point)4 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)4 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)4 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)4 TimeGraphControl (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl)3 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)2