use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotEclipseSwtChart in project tracecompass by tracecompass.
the class XYChartViewTest method testZoomToSelection.
/**
* Test zoom to selection
*/
@Test
public void testZoomToSelection() {
SWTBotEclipseSwtChart xyChart = new SWTBotEclipseSwtChart(fViewBot.bot());
xyChart.setFocus();
assertEquals(80, fXyViewer.getWindowDuration());
/* set selection to trace start time */
ITmfTimestamp selStartTime = TmfTimestamp.fromNanos(30L);
ITmfTimestamp selEndTime = TmfTimestamp.fromNanos(80L);
TmfTimeRange range = new TmfTimeRange(selStartTime, selEndTime);
TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, selStartTime, selEndTime));
// Wait till selection is finished
fViewBot.bot().waitUntil(new DefaultCondition() {
@Override
public boolean test() throws Exception {
return (fXyViewer.getSelectionEndTime() - fXyViewer.getSelectionBeginTime()) == getDuration(range);
}
@Override
public String getFailureMessage() {
return "SWT Chart is null";
}
});
fireKeyInGraph(xyChart, 'z');
fViewBot.bot().waitUntil(new SeriesCondition(fXyViewer, getDuration(range)));
}
use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotEclipseSwtChart in project tracecompass by tracecompass.
the class XYChartViewTest method testHorizontalZoom.
/**
* Test horizontal zoom, we can see a rounding error
*/
@Test
public void testHorizontalZoom() {
fViewBot.setFocus();
assertEquals(80, fXyViewer.getWindowDuration());
SWTBotEclipseSwtChart xyChart = new SWTBotEclipseSwtChart(fViewBot.bot());
fireKeyInGraph(xyChart, '=');
fViewBot.bot().waitUntil(new SeriesCondition(fXyViewer, 52));
fireKeyInGraph(xyChart, '+');
fViewBot.bot().waitUntil(new SeriesCondition(fXyViewer, 34));
fireKeyInGraph(xyChart, '-');
fViewBot.bot().waitUntil(new SeriesCondition(fXyViewer, 51));
fireKeyInGraph(xyChart, '-');
fViewBot.bot().waitUntil(new SeriesCondition(fXyViewer, 77));
resetTimeRange();
/* Zoom using zoom-in and zoom-out buttons */
SWTBotToolbarButton button = fViewBot.toolbarButton("Zoom In");
button.click();
fViewBot.bot().waitUntil(new SeriesCondition(fXyViewer, 52));
button = fViewBot.toolbarButton("Zoom Out");
button.click();
fViewBot.bot().waitUntil(new SeriesCondition(fXyViewer, 78));
/*
* 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 = fXyViewer.getWindowDuration();
fireKeyInGraph(xyChart, 'w');
fViewBot.bot().waitUntil(new SeriesUpdatedCondition(fXyViewer, previousRange, false));
previousRange = fXyViewer.getWindowDuration();
fireKeyInGraph(xyChart, 's');
fViewBot.bot().waitUntil(new SeriesUpdatedCondition(fXyViewer, previousRange, true));
}
use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotEclipseSwtChart in project tracecompass by tracecompass.
the class XYChartViewTest method testKeyboardNavigation.
/**
* Test 'a' and 'd' navigation
*/
@Test
public void testKeyboardNavigation() {
SWTBotEclipseSwtChart xyChart = new SWTBotEclipseSwtChart(fViewBot.bot());
xyChart.setFocus();
assertEquals(80, fXyViewer.getWindowDuration());
TmfTimeRange updatedWindowRange = new TmfTimeRange(TmfTimestamp.fromNanos(40), TmfTimestamp.fromNanos(120));
// move to the right
fireKeyInGraph(xyChart, 'd');
fViewBot.bot().waitUntil(new SeriesCondition(fXyViewer, getDuration(updatedWindowRange)));
// move to the left
fireKeyInGraph(xyChart, 'a');
fViewBot.bot().waitUntil(new SeriesCondition(fXyViewer, getDuration(INITIAL_WINDOW_RANGE)));
}
Aggregations