Search in sources :

Example 1 with CounterView

use of org.eclipse.tracecompass.analysis.counters.ui.views.CounterView in project tracecompass by tracecompass.

the class NewCounterViewTest method testDisplayingDataSeries.

/**
 * Validate the Counters view data model.
 */
@Test
public void testDisplayingDataSeries() {
    // Setup the chart viewer
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof CounterView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    chartViewer.setNbPoints(NUMBER_OF_POINTS);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    final Chart chart = getChart();
    assertNotNull(chart);
    assertEquals(0, chart.getSeriesSet().getSeries().length);
    // Check the counter entry
    SWTBotTree treeBot = getSWTBotView().bot().tree();
    WaitUtils.waitUntil(tree -> tree.rowCount() >= 1, treeBot, "The tree viewer did not finish loading.");
    SWTBotTreeItem root = treeBot.getTreeItem(TRACE_NAME);
    SWTBotTreeItem counter = retrieveTreeItem(root, COUNTER_NAME);
    assertNotNull(counter);
    counter.check();
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    WaitUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 1, chart, "The data series did not load.");
    // Ensure the data series has the correct styling
    verifySeriesStyle(MAIN_SERIES_NAME, ISeries.SeriesType.LINE, BLUE, LineStyle.SOLID, false);
    // Ensure the data model is valid
    WaitUtils.waitUntil(json -> isChartDataValid(chart, json), "resources/minor_faults-res50.json", "The chart data is not valid.");
}
Also used : IViewPart(org.eclipse.ui.IViewPart) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) CounterView(org.eclipse.tracecompass.analysis.counters.ui.views.CounterView) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) TmfCommonXAxisChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer) Chart(org.eclipse.swtchart.Chart) Test(org.junit.Test) XYDataProviderBaseTest(org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)

Aggregations

SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)1 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)1 Chart (org.eclipse.swtchart.Chart)1 CounterView (org.eclipse.tracecompass.analysis.counters.ui.views.CounterView)1 XYDataProviderBaseTest (org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)1 TmfCommonXAxisChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer)1 IViewPart (org.eclipse.ui.IViewPart)1 Test (org.junit.Test)1