use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.
the class FindDialogTestBase method before.
/**
* Initialize the test and open the timegraph view and the find dialog
*/
@Before
public void before() {
String title = getViewTitle();
fViewBot = fBot.viewByTitle(title);
fViewBot.show();
fTimeGraphBot = new SWTBotTimeGraph(fViewBot.bot());
TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) fViewBot.getViewReference().getPart(false), new TmfTimeRange(START_TIME, START_TIME), START_TIME));
fViewBot.setFocus();
openDialog(fViewBot);
fFindText = getFindText();
}
use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.
the class TimeGraphViewTest method testHorizontalZoom.
/**
* Test horizontal zoom, we can see a rounding error
*/
@Test
public void testHorizontalZoom() {
resetTimeRange();
SWTBotTimeGraph timegraph = fTimeGraph;
TimeGraphViewStub view = getView();
timegraph.setFocus();
assertEquals(80, getDuration(view.getWindowRange()));
fireKeyInGraph(timegraph, '=');
fViewBot.bot().waitUntil(new WindowRangeCondition(view, 52));
fireKeyInGraph(timegraph, '+');
fViewBot.bot().waitUntil(new WindowRangeCondition(view, 34));
fireKeyInGraph(timegraph, '-');
fViewBot.bot().waitUntil(new WindowRangeCondition(view, 51));
fireKeyInGraph(timegraph, '-');
fViewBot.bot().waitUntil(new WindowRangeCondition(view, 77));
/*
* Note that 'w' and 's' zooming is based on mouse position. Just check
* if window range was increased or decreased to avoid inaccuracy due to
* the mouse position in test environment.
*/
long previousRange = getDuration(view.getWindowRange());
fireKeyInGraph(timegraph, 'w');
fViewBot.bot().waitUntil(new WindowRangeUpdatedCondition(view, previousRange, false));
previousRange = getDuration(view.getWindowRange());
fireKeyInGraph(timegraph, 's');
fViewBot.bot().waitUntil(new WindowRangeUpdatedCondition(view, previousRange, true));
}
use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.
the class TimeGraphViewTest method testExpandAndCollapse.
/**
* Test expand and collapes of a timegraph view
*/
@Test
public void testExpandAndCollapse() {
String pg = "Plumber guy";
String hpc = "Hungry pie chart";
String element = "row2";
int totalItems = 17;
resetTimeRange();
SWTBotTimeGraph timegraph = fTimeGraph;
assertEquals(totalItems, getVisibleItems(timegraph).size());
SWTBotTimeGraphEntry[] entries = null;
entries = timegraph.getEntries();
assertNotNull(entries);
assertNotNull(timegraph.getEntry(hpc, element));
timegraph.collapseAll();
entries = timegraph.getEntries();
assertEquals(3, getVisibleItems(timegraph).size());
timegraph.getEntry(pg).select();
fireKey(timegraph, true, '+');
assertEquals(10, getVisibleItems(timegraph).size());
timegraph.getEntry(pg).select();
fireKey(timegraph, true, '-');
assertEquals(3, getVisibleItems(timegraph).size());
timegraph.getEntry(hpc).select();
fireKey(timegraph, true, '+');
assertEquals(10, getVisibleItems(timegraph).size());
assertNotNull(timegraph.getEntry(hpc, element));
timegraph.getEntry(pg).select();
fireKey(timegraph, true, '*');
timegraph.getEntry(hpc).select();
fireKey(timegraph, true, '*');
assertEquals(totalItems, getVisibleItems(timegraph).size());
assertNotNull(timegraph.getEntry(hpc, element));
}
use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.
the class TimeGraphViewTest method testHideEmptyRows.
/**
* Integration test for the time event filtering dialog
*/
@Test
public void testHideEmptyRows() {
resetTimeRange();
SWTBotTimeGraph timegraph = fTimeGraph;
assertTrue("timegraph visible", timegraph.isVisible());
timegraph.setFocus();
/* set time range */
setWindowRange(50L, 75L);
SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 17, timegraph, () -> "All entries should be visible here: " + getVisibleItems(timegraph));
/* hide empty rows (includes a row with only 1 marker) */
fViewBot.toolbarButton("Hide Empty Rows").click();
SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 10, timegraph, () -> "Fewer entries should be visible here: " + getVisibleItems(timegraph));
/* change time range to exclude row with markers */
setWindowRange(60L, 75L);
SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 9, timegraph, () -> "Fewer entries should be visible here: " + getVisibleItems(timegraph));
/* add a time events filter */
timegraph.setFocus();
// Move mouse to middle of the timegraph
timegraph.moveMouseToWidget();
// Press '/' to open the filter dialog
timegraph.pressShortcut(KeyStroke.getInstance('/'));
SWTBot viewBot = fViewBot.bot();
SWTBotShell dialogShell = viewBot.shell("Time Event Filter").activate();
SWTBot shellBot = dialogShell.bot();
SWTBotText text = shellBot.text();
text.setText("Head3");
text.setFocus();
SWTBotUtils.pressShortcut(text, Keystrokes.CR);
SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 2, timegraph, () -> "Fewer entries should be visible here: " + getVisibleItems(timegraph));
/* show also empty rows */
fViewBot.toolbarButton("Hide Empty Rows").click();
/* All rows will be filtered by time events filter */
SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 2, timegraph, () -> "Same number of entries should be visible here: " + getVisibleItems(timegraph));
/* remove time events filter */
dialogShell = viewBot.shell("Time Event Filter").activate();
shellBot = dialogShell.bot();
SWTBotButton button = shellBot.buttonWithTooltip("Close (Esc)");
button.click();
SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 17, timegraph, () -> "All entries should be visible here: " + getVisibleItems(timegraph));
}
use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.
the class TimeGraphViewTest method testCollapseExpandUsingEnter.
/**
* Test the enter key, which toggles expand/collapse.
*/
@Test
public void testCollapseExpandUsingEnter() {
String pg = "Plumber guy";
resetTimeRange();
SWTBotTimeGraph timegraph = fTimeGraph;
assertEquals(0, timegraph.selection().columnCount());
timegraph.getEntry(pg).select();
assertEquals(1, timegraph.selection().columnCount());
assertEquals(17, getVisibleItems(timegraph).size());
fireKey(timegraph, true, SWT.CR);
assertEquals(1, timegraph.selection().columnCount());
assertEquals('[' + pg + ']', timegraph.selection().get(0).toString());
assertEquals(10, getVisibleItems(timegraph).size());
fireKey(timegraph, true, SWT.CR);
assertEquals(1, timegraph.selection().columnCount());
assertEquals('[' + pg + ']', timegraph.selection().get(0).toString());
assertEquals(17, getVisibleItems(timegraph).size());
timegraph.getEntry(pg, "Hat1").select();
fireKey(timegraph, true, SWT.CR);
assertEquals(1, timegraph.selection().columnCount());
assertEquals("[Hat1]", timegraph.selection().get(0).toString());
assertEquals(17, getVisibleItems(timegraph).size());
}
Aggregations