Search in sources :

Example 16 with SWTBotTimeGraph

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

the class TimeGraphViewTest method testTimegraphEventFiltering.

/**
 * Integration test for the time event filtering dialog
 */
@Test
public void testTimegraphEventFiltering() {
    SWTWorkbenchBot bot = fBot;
    resetTimeRange();
    SWTBot viewBot = fViewBot.bot();
    SWTBotTimeGraph timegraph = fTimeGraph;
    assertTrue("timegraph visible", timegraph.isVisible());
    timegraph.setFocus();
    Rectangle bounds = fBounds;
    ImageHelper ref = ImageHelper.grabImage(bounds);
    timegraph.setFocus();
    // Move mouse to middle of the timegraph
    timegraph.moveMouseToWidget();
    // Press '/' to open the filter dialog
    timegraph.pressShortcut(KeyStroke.getInstance('/'));
    SWTBotShell dialogShell = viewBot.shell("Time Event Filter").activate();
    SWTBot shellBot = dialogShell.bot();
    SWTBotText text = shellBot.text();
    text.setText("Hat1");
    bot.waitWhile(fTimeGraphIsDirty);
    timegraph.setFocus();
    ImageHelper filtered = ImageHelper.waitForNewImage(bounds, ref);
    /* Compare with the original, they should be different */
    int refHatCount = ref.getHistogram().count(fHat);
    int filteredHatCount = filtered.getHistogram().count(fHat);
    int refHairCount = ref.getHistogram().count(fHair);
    int filteredHairCount = filtered.getHistogram().count(fHair);
    assertTrue("Count of \"HAT\" did not decrease to non-zero", filteredHatCount < refHatCount && filteredHatCount > 0);
    assertTrue("Count of \"HAIR\" did not decrease to zero", filteredHairCount < refHairCount && filteredHairCount == 0);
    dialogShell = viewBot.shell("Time Event Filter").activate();
    shellBot = dialogShell.bot();
    text = shellBot.text();
    text.setFocus();
    SWTBotUtils.pressShortcut(text, Keystrokes.CR);
    bot.waitWhile(fTimeGraphIsDirty);
    List<String> visibleItems = getVisibleItems(timegraph);
    assertEquals("Fewer entries should be visible here: " + visibleItems, 3, visibleItems.size());
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText) Rectangle(org.eclipse.swt.graphics.Rectangle) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) ImageHelper(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ImageHelper) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Example 17 with SWTBotTimeGraph

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

the class KernelTimeGraphViewTestBase method testOpenCloseOpen.

/**
 * Test that re-opening a view repoopulates it properly.
 */
@Test
public void testOpenCloseOpen() {
    SWTBotView viewBot = openView();
    SWTBotTimeGraph tgBot = new SWTBotTimeGraph(viewBot.bot());
    Map<String, List<String>> before = getItemNames(tgBot);
    viewBot.close();
    viewBot = openView();
    tgBot = new SWTBotTimeGraph(viewBot.bot());
    Map<String, List<String>> after = getItemNames(tgBot);
    assertEquals(before, after);
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 18 with SWTBotTimeGraph

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

the class TimeGraphViewUiContextTestBase method testExpandedState.

/**
 * Test the expand state of time graph entries when switching traces This test
 * collapse some entries, switch between traces then test that the expanded
 * count did not change
 */
@Test
public void testExpandedState() {
    // 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 count1 = timegraphBot.getExpandedElementCount();
    // Collapse specific entries
    for (String label : getItemLabel()) {
        timegraphBot.expandEntry(false, BUG446190, label);
    }
    int count2 = timegraphBot.getExpandedElementCount();
    assertTrue("Expanded entries count sould be less than " + count1 + " but actual value is " + count2, count2 < count1);
    int count3 = switchBetweenTraces(timegraphBot);
    assertEquals("Expanded entries count is " + count3 + " but it should be " + count2, count2, count3);
    // collapse all entries
    timegraphBot.collapseAll();
    int count4 = switchBetweenTraces(timegraphBot);
    assertTrue("Expanded entries count soswitchBetweenTraces(timegraphBot);uld be less than " + count3 + " but actual value is " + count4, count4 < count3);
    int count5 = switchBetweenTraces(timegraphBot);
    assertEquals("Expanded entries count is " + count5 + " but it should be " + count4, count4, count5);
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) Test(org.junit.Test)

Example 19 with SWTBotTimeGraph

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

the class ControlFlowViewSortingTest method testColumnSorting.

// ------------------------------------------------------------------------
// Test case(s)
// ------------------------------------------------------------------------
/**
 * UI test of sorting of processes in CFV based on column selection. To verify that the sorting
 * was executed correctly, the test will use bot.waitUntil() the column content has the right
 * order.
 */
@Test
public void testColumnSorting() {
    fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) fViewBot.getViewReference().getPart(false), new TmfTimeRange(TRACE_START_TIME, TRACE_START_TIME), TRACE_START_TIME));
    // Create a known state
    applyFilter();
    final SWTBotTree tree = fViewBot.bot().tree();
    final SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(fViewBot.bot());
    final SWTBotTimeGraphEntry timeGraphEntry = timeGraph.getEntry(TRACE_NAME, SYSTEMD_PROCESS_NAME);
    timeGraphEntry.select();
    testProcessSorting(tree, timeGraph);
    testTidSorting(tree, timeGraph);
    testPidSorting(tree, timeGraph);
    testPtidSorting(tree, timeGraph);
    testBirthtimeSorting(tree, timeGraph);
}
Also used : AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 20 with SWTBotTimeGraph

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

the class ControlFlowViewTest method testDynamicFilteringCpu.

/**
 * Test dynamic filters dialog on CPU
 */
@Test
public void testDynamicFilteringCpu() {
    /* 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);
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(getViewBot().bot());
    SWTBotTimeGraphEntry traceEntry = timeGraph.getEntry(LttngTraceGenerator.getName());
    SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 225, traceEntry, () -> "Entries size expected:225 actual:" + traceEntry.getEntries().length);
    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);
    assertFalse(activeThreadsCheckbox.isChecked());
    SWTBotRadio onCpuRadio = shell.bot().radio(DYNAMIC_FILTERS_ON_CPU_RADIO);
    SWTBotText onCpuField = shell.bot().textWithMessage(DYNAMIC_FILTER_ON_CPU_FIELD_MESSAGE);
    /* Toggle active thread filter button */
    activeThreadsCheckbox.click();
    assertTrue(activeThreadsCheckbox.isChecked());
    /* Filter on selected CPUs */
    onCpuRadio.click();
    onCpuField.setText("0");
    shell.bot().button(DIALOG_OK).click();
    /*
         * A zoom thread is started after applying the filter. Make sure that the time graph
         * is ready before continuing with the test
         */
    timeGraphIsReadyCondition(range);
    /* Change window range to 50 us */
    range = new TmfTimeRange(START_TIME, START_TIME.normalize(50000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, range.getStartTime(), range.getEndTime()));
    timeGraphIsReadyCondition(range);
    /* Verify that number active entries changed */
    SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 1, traceEntry, () -> "Entries size expected:1 actual:" + traceEntry.getEntries().length);
    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);
    assertTrue(activeThreadsCheckbox.isChecked());
    /*
         * Test Active Filter buttons toggle
         */
    activeThreadsCheckbox.click();
    /* All objects should be enabled except for the CPU ranges field */
    assertFalse(activeThreadsCheckbox.isChecked());
}
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) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText) 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) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) 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