use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project tracecompass by tracecompass.
the class LamiChartViewerTest method testSimilarRows.
/**
* Test a few charts with the multiple similar row dataset.
*
* @throws SecurityException
* If a security manager is present and any the wrong class is
* loaded or the class loader is not the same as its ancestor's
* loader.
*
* @throws IllegalArgumentException
* the object is not the correct class type
*/
@Test
public void testSimilarRows() throws SecurityException, IllegalArgumentException {
SWTBotView viewBot = executeAnalysis(LamiAnalyses.MULTIPLE_SIMILAR_ROW);
// Create a new chart
SWTBotRootMenu viewMenu = viewBot.viewMenu();
SWTBotMenu menu = viewMenu.menu("New custom chart");
menu.click();
// Create a bar chart of Wakee process (name) vs scheduling latency,
// Priority and Target CPU
SWTBotCustomChartUtils.selectChartType(fBot, ChartType.BAR_CHART);
SWTBotCustomChartUtils.addSeries(fBot, "Wakee process (name)", ImmutableSet.of("Scheduling latency (ns)", "Priority", "Target CPU"));
SWTBotCustomChartUtils.confirmDialog(fBot);
WaitUtils.waitForJobs();
// Wait for the viewer and verify its parameters
@Nullable Chart customChart = viewBot.bot().widget(WidgetOfType.widgetOfType(Chart.class), 0);
assertNotNull(customChart);
Event mouseMove = new Event();
mouseMove.type = SWT.MouseEnter;
customChart.getDisplay().post(mouseMove);
fBot.waitUntil(ConditionHelpers.numberOfSeries(customChart, 3));
SWTBotChart chartBot = new SWTBotChart(customChart);
assertVisible(chartBot);
// Verify the titles
SWTBotCustomChartUtils.assertTitles(customChart, "Scheduling log", "Wakee process (name)", "Value");
// Make sure the axis formatter have the right categories and range
String[] xValues = new String[6];
Arrays.fill(xValues, "swapper/5");
SWTBotCustomChartUtils.assertCategoriesAxis(customChart, AxisType.X, xValues);
SWTBotCustomChartUtils.assertAxisRange(customChart, AxisType.Y, 0, 2);
SWTBotCustomChartUtils.assertAxisLogscale(customChart, AxisType.Y, false);
// Verify the series titles
SWTBotCustomChartUtils.assertSeriesTitle(customChart, ImmutableList.of("Scheduling latency (ns)", "Priority", "Target CPU"));
closeCharts();
// Create a bar chart of Waker process (name) vs scheduling latency,
// Priority and Target CPU
menu.click();
fBot.shell("Custom chart creation").activate();
SWTBotCustomChartUtils.selectChartType(fBot, ChartType.BAR_CHART);
SWTBotCustomChartUtils.addSeries(fBot, "Waker process (name)", ImmutableSet.of("Scheduling latency (ns)", "Priority", "Target CPU"));
SWTBotCustomChartUtils.confirmDialog(fBot);
WaitUtils.waitForJobs();
// Wait for the viewer and verify its parameters
customChart = viewBot.bot().widget(WidgetOfType.widgetOfType(Chart.class), 0);
assertNotNull(customChart);
customChart.getDisplay().post(mouseMove);
fBot.waitUntil(ConditionHelpers.numberOfSeries(customChart, 3));
chartBot = new SWTBotChart(customChart);
assertVisible(chartBot);
// Verify the titles
SWTBotCustomChartUtils.assertTitles(customChart, "Scheduling log", "Waker process (name)", "Value");
// Make sure the axis formatter have the right categories and range
Arrays.fill(xValues, "?");
SWTBotCustomChartUtils.assertCategoriesAxis(customChart, AxisType.X, xValues);
SWTBotCustomChartUtils.assertAxisRange(customChart, AxisType.Y, 0, 2);
SWTBotCustomChartUtils.assertAxisLogscale(customChart, AxisType.Y, false);
// Verify the series titles
SWTBotCustomChartUtils.assertSeriesTitle(customChart, ImmutableList.of("Scheduling latency (ns)", "Priority", "Target CPU"));
closeCharts();
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project tracecompass by tracecompass.
the class LamiChartViewerTest method testScatterMultipleRow.
/**
* Test a few scatter charts with the multiple row dataset.
*
* @throws SecurityException
* If a security manager is present and any the wrong class is
* loaded or the class loader is not the same as its ancestor's
* loader.
*
* @throws IllegalArgumentException
* the object is not the correct class type
*/
@Test
public void testScatterMultipleRow() throws SecurityException, IllegalArgumentException {
SWTBotView viewBot = executeAnalysis(LamiAnalyses.MULTIPLE_ROW);
// Get the expected maximum and minimum values of each axis
LamiResultTable resultTable = LamiAnalyses.MULTIPLE_ROW.getAnalysis().getResultTable(0);
Long minX = Long.MAX_VALUE;
Long maxX = Long.MIN_VALUE;
Long minY = Long.MAX_VALUE;
Long maxY = Long.MIN_VALUE;
for (LamiTableEntry entry : resultTable.getEntries()) {
Long wakeupTs = ((LamiLongNumber) entry.getValue(0)).getValue();
Long switchTs = ((LamiLongNumber) entry.getValue(1)).getValue();
Long latency = ((LamiLongNumber) entry.getValue(2)).getValue();
if (wakeupTs != null) {
minX = Math.min(minX, wakeupTs);
maxX = Math.max(maxX, wakeupTs);
}
if (switchTs != null) {
minX = Math.min(minX, switchTs);
maxX = Math.max(maxX, switchTs);
}
if (latency != null) {
minY = Math.min(minY, latency);
maxY = Math.max(maxY, latency);
}
}
// Create a new chart
SWTBotRootMenu viewMenu = viewBot.viewMenu();
SWTBotMenu menu = viewMenu.menu("New custom chart");
menu.click();
// Create a scatter chart of Wakeup timestamp vs scheduling latency
// and Switch timestamp vs scheduling latency
SWTBotCustomChartUtils.selectChartType(fBot, ChartType.SCATTER_CHART);
SWTBotCustomChartUtils.addSeries(fBot, "Wakeup timestamp", Collections.singleton("Scheduling latency (ns)"));
SWTBotCustomChartUtils.addSeries(fBot, "Switch timestamp", Collections.singleton("Scheduling latency (ns)"));
SWTBotCustomChartUtils.confirmDialog(fBot);
WaitUtils.waitForJobs();
// Wait for the viewer and verify its parameters
@Nullable Chart customChart = viewBot.bot().widget(WidgetOfType.widgetOfType(Chart.class), 0);
Event mouseMove = new Event();
mouseMove.type = SWT.MouseEnter;
customChart.getDisplay().post(mouseMove);
assertNotNull(customChart);
fBot.waitUntil(ConditionHelpers.numberOfSeries(customChart, 2));
SWTBotChart chartBot = new SWTBotChart(customChart);
assertVisible(chartBot);
// Verify the titles
SWTBotCustomChartUtils.assertTitles(customChart, "Scheduling log", "Value (ss.SSS)", "Scheduling latency (ns)");
// Make sure the axis formatters have the right range
SWTBotCustomChartUtils.assertAxisRange(customChart, AxisType.X, minX, maxX);
SWTBotCustomChartUtils.assertAxisRange(customChart, AxisType.Y, minY, maxY);
SWTBotCustomChartUtils.assertAxisLogscale(customChart, AxisType.Y, false);
// Verify the series titles
SWTBotCustomChartUtils.assertSeriesTitle(customChart, ImmutableList.of("Scheduling latency by Wakeup timestamp", "Scheduling latency by Switch timestamp"));
closeCharts();
// Create the same chart, but with log scale enabled in Y. Make sure
// the results are the same
menu.click();
SWTBotCustomChartUtils.selectChartType(fBot, ChartType.SCATTER_CHART);
SWTBotCustomChartUtils.addSeries(fBot, "Wakeup timestamp", Collections.singleton("Scheduling latency (ns)"));
SWTBotCustomChartUtils.addSeries(fBot, "Switch timestamp", Collections.singleton("Scheduling latency (ns)"));
SWTBotCustomChartUtils.setLogScale(fBot, AxisType.Y);
SWTBotCustomChartUtils.confirmDialog(fBot);
WaitUtils.waitForJobs();
// Wait for the viewer and verify its parameters
customChart = viewBot.bot().widget(WidgetOfType.widgetOfType(Chart.class), 0);
assertNotNull(customChart);
customChart.getDisplay().post(mouseMove);
fBot.waitUntil(ConditionHelpers.numberOfSeries(customChart, 2));
chartBot = new SWTBotChart(customChart);
assertVisible(chartBot);
// Verify the titles
SWTBotCustomChartUtils.assertTitles(customChart, "Scheduling log", "Value (ss.SSS)", "Scheduling latency (ns)");
// Make sure the axis formatter have the right range
SWTBotCustomChartUtils.assertAxisRange(customChart, AxisType.X, minX, maxX);
// Logscale charts are clamped to 0
SWTBotCustomChartUtils.assertAxisRange(customChart, AxisType.Y, 0, maxY);
SWTBotCustomChartUtils.assertAxisLogscale(customChart, AxisType.Y, true);
// Verify the series titles
SWTBotCustomChartUtils.assertSeriesTitle(customChart, ImmutableList.of("Scheduling latency by Wakeup timestamp", "Scheduling latency by Switch timestamp"));
closeCharts();
}
Aggregations