Search in sources :

Example 1 with IndexedSeriesModel

use of org.eclipse.swtchart.model.IndexedSeriesModel in project tracecompass by tracecompass.

the class PatternDensityViewTest method testWithTrace.

/**
 * Test the pattern density view and its viewers data
 *
 * @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 NoSuchFieldException
 *             Field not available
 * @throws IllegalAccessException
 *             Field is inaccessible
 * @throws IllegalArgumentException
 *             the object is not the correct class type
 */
@Test
public void testWithTrace() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
    setDensityViewer();
    WaitUtils.waitForJobs();
    // Test the table content
    SWTBotTable tableBot = new SWTBotTable(fDensityViewer.getTableViewer().getTable());
    fBot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, SYSTEM_CALL_PREFIX, 0, 3));
    tableBot.header(COLUMN_HEADER).click();
    fBot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, SYSTEM_CALL_PREFIX, 0, 3));
    tableBot.header(COLUMN_HEADER).click();
    fBot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, SYSTEM_CALL_PREFIX, 0, 3));
    // Test the chart content
    final Chart densityChart = fDensityChart;
    assertNotNull(densityChart);
    fBot.waitUntil(ConditionHelpers.numberOfSeries(densityChart, 1));
    SWTBotChart chartBot = new SWTBotChart(densityChart);
    assertVisible(chartBot);
    ISeriesSet seriesSet = fDensityChart.getSeriesSet();
    assertNotNull(seriesSet);
    ISeries<?>[] series = seriesSet.getSeries();
    assertNotNull(series);
    // Verify that the chart has 1 series
    assertEquals(1, series.length);
    // Verify that the series has data
    assertTrue(((IndexedSeriesModel<?>) series[0].getDataModel()).size() > 0);
}
Also used : ISeriesSet(org.eclipse.swtchart.ISeriesSet) IndexedSeriesModel(org.eclipse.swtchart.model.IndexedSeriesModel) SWTBotTable(org.eclipse.swtbot.swt.finder.widgets.SWTBotTable) ISeries(org.eclipse.swtchart.ISeries) Chart(org.eclipse.swtchart.Chart) Test(org.junit.Test)

Example 2 with IndexedSeriesModel

use of org.eclipse.swtchart.model.IndexedSeriesModel in project tracecompass by tracecompass.

the class PatternScatterChartViewTest method testWithTrace.

/**
 * Test the pattern latency scatter graph. This method test if the chart has one
 * series and the series has data
 */
@Test
public void testWithTrace() {
    // Get the chart viewer and wait for the view to be ready
    WaitUtils.waitForJobs();
    TmfXYChartViewer chartViewer = getChartViewer();
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    // Check all the items in the tree
    final Chart chart = fScatterChart;
    assertNotNull(chart);
    SWTBotView viewBot = fBot.viewById(VIEW_ID);
    SWTBotTreeItem[] items = viewBot.bot().tree().getAllItems();
    for (SWTBotTreeItem item : items) {
        item.check();
    }
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length > 0, chart, "No data available");
    // Look at the presence of data in the chart
    SWTBotChart chartBot = new SWTBotChart(chart);
    assertVisible(chartBot);
    final Range range = chart.getAxisSet().getXAxes()[0].getRange();
    assertEquals(100000000, range.upper - range.lower, 0);
    ISeriesSet seriesSet = fScatterChart.getSeriesSet();
    assertNotNull(seriesSet);
    ISeries<?>[] series = seriesSet.getSeries();
    assertNotNull(series);
    // Verify that the chart has more than 1 series
    assertTrue(series.length > 1);
    // Verify that each series has data
    for (int i = 0; i < series.length; i++) {
        assertTrue("Verifying series " + i, ((IndexedSeriesModel<?>) series[i].getDataModel()).size() > 0);
    }
}
Also used : TmfXYChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer) ISeriesSet(org.eclipse.swtchart.ISeriesSet) IndexedSeriesModel(org.eclipse.swtchart.model.IndexedSeriesModel) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) Range(org.eclipse.swtchart.Range) ISeries(org.eclipse.swtchart.ISeries) Chart(org.eclipse.swtchart.Chart) Test(org.junit.Test)

Aggregations

Chart (org.eclipse.swtchart.Chart)2 ISeries (org.eclipse.swtchart.ISeries)2 ISeriesSet (org.eclipse.swtchart.ISeriesSet)2 IndexedSeriesModel (org.eclipse.swtchart.model.IndexedSeriesModel)2 Test (org.junit.Test)2 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)1 SWTBotTable (org.eclipse.swtbot.swt.finder.widgets.SWTBotTable)1 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)1 Range (org.eclipse.swtchart.Range)1 TmfXYChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer)1