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());
}
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);
}
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);
}
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);
}
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());
}
Aggregations