Search in sources :

Example 1 with ChartEditor

use of org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartEditor in project linuxtools by eclipse.

the class ChartTests method testChartCallback.

@Test
public void testChartCallback() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testChartCallback");
    IAction chartAction = getChartAction();
    assertNotNull(chartAction);
    chartAction.run();
    IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    assertTrue(part instanceof ChartEditor);
    Chart control = ((ChartEditor) part).getControl();
    ILineSeries lsTotal = (ILineSeries) control.getSeriesSet().getSeries(// $NON-NLS-1$
    Messages.getString("HeapChart.Total_Heap"));
    Point p1 = lsTotal.getPixelCoordinates(4);
    HeapChart heapChart = ((ChartEditorInput) ((ChartEditor) part).getEditorInput()).getChart();
    int x = control.getAxisSet().getXAxis(0).getPixelCoordinate(heapChart.time[4]);
    int y = control.getAxisSet().getYAxis(0).getPixelCoordinate(heapChart.dataTotal[4]);
    assertEquals(x, p1.x);
    assertEquals(y, p1.y);
}
Also used : HeapChart(org.eclipse.linuxtools.internal.valgrind.massif.charting.HeapChart) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ChartEditor(org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartEditor) IAction(org.eclipse.jface.action.IAction) ILineSeries(org.swtchart.ILineSeries) IEditorPart(org.eclipse.ui.IEditorPart) Point(org.eclipse.swt.graphics.Point) ChartEditorInput(org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartEditorInput) Chart(org.swtchart.Chart) HeapChart(org.eclipse.linuxtools.internal.valgrind.massif.charting.HeapChart) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Aggregations

ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)1 IAction (org.eclipse.jface.action.IAction)1 ChartEditor (org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartEditor)1 ChartEditorInput (org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartEditorInput)1 HeapChart (org.eclipse.linuxtools.internal.valgrind.massif.charting.HeapChart)1 Point (org.eclipse.swt.graphics.Point)1 IEditorPart (org.eclipse.ui.IEditorPart)1 Test (org.junit.Test)1 Chart (org.swtchart.Chart)1 ILineSeries (org.swtchart.ILineSeries)1