Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Grunberg2011-12-14 17:23:58 -0500
committerRoland Grunberg2011-12-20 13:35:28 -0500
commit572b52cea19d3936d0cce41265d3216d8f2ea9c4 (patch)
tree845c2ba4c5bbcc7db6e53810a81d99ab01f5a729 /valgrind
parente00ae967654548f700766347dc05417d59f09ccf (diff)
downloadorg.eclipse.linuxtools-572b52cea19d3936d0cce41265d3216d8f2ea9c4.tar.gz
org.eclipse.linuxtools-572b52cea19d3936d0cce41265d3216d8f2ea9c4.tar.xz
org.eclipse.linuxtools-572b52cea19d3936d0cce41265d3216d8f2ea9c4.zip
Fix a Massif test to check the correctness of a charted data point.
Diffstat (limited to 'valgrind')
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.massif.tests/META-INF/MANIFEST.MF3
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/ChartTests.java30
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/birt/HeapChart.java2
3 files changed, 17 insertions, 18 deletions
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/META-INF/MANIFEST.MF b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/META-INF/MANIFEST.MF
index 6c6dbce1ab..9dd45345ff 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/META-INF/MANIFEST.MF
+++ b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/META-INF/MANIFEST.MF
@@ -36,5 +36,6 @@ Import-Package: org.eclipse.birt.chart.computation,
org.eclipse.linuxtools.valgrind.launch,
org.eclipse.linuxtools.valgrind.ui,
org.eclipse.ui,
- org.eclipse.ui.texteditor
+ org.eclipse.ui.texteditor,
+ org.swtchart
Export-Package: org.eclipse.linuxtools.internal.valgrind.massif.tests
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/ChartTests.java b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/ChartTests.java
index 1253b087b9..b7cc012612 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/ChartTests.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.massif.tests/src/org/eclipse/linuxtools/internal/valgrind/massif/tests/ChartTests.java
@@ -12,8 +12,6 @@ package org.eclipse.linuxtools.internal.valgrind.massif.tests;
import java.util.Arrays;
-import org.eclipse.birt.chart.computation.DataPointHints;
-import org.eclipse.birt.chart.event.WrappedStructureSource;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -27,20 +25,23 @@ import org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode;
import org.eclipse.linuxtools.internal.valgrind.massif.MassifLaunchConstants;
import org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot;
import org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart;
-import org.eclipse.linuxtools.internal.valgrind.massif.birt.ChartControl;
import org.eclipse.linuxtools.internal.valgrind.massif.birt.ChartEditor;
import org.eclipse.linuxtools.internal.valgrind.massif.birt.ChartEditorInput;
import org.eclipse.linuxtools.internal.valgrind.massif.birt.ChartLocationsDialog;
import org.eclipse.linuxtools.internal.valgrind.massif.birt.HeapChart;
+import org.eclipse.linuxtools.internal.valgrind.massif.birt.Messages;
import org.eclipse.linuxtools.internal.valgrind.ui.ValgrindUIPlugin;
import org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PlatformUI;
+import org.swtchart.Chart;
+import org.swtchart.ILineSeries;
public class ChartTests extends AbstractMassifTest {
@Override
@@ -96,19 +97,16 @@ public class ChartTests extends AbstractMassifTest {
IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (part instanceof ChartEditor) {
- ChartControl control = ((ChartEditor) part).getControl();
- Event event = new Event();
- event.button = 1;
- event.count = 1;
- event.widget = control;
- MouseEvent mEvent = new MouseEvent(event);
- DataPointHints source = new DataPointHints(null, null, null, null, null, null, null, null, null, 4, null, 0, null);
- control.callback(mEvent, new WrappedStructureSource(source), null);
-
- TableViewer viewer = ((MassifViewPart) view.getDynamicView()).getTableViewer();
- MassifSnapshot[] snapshots = (MassifSnapshot[]) viewer.getInput();
- MassifSnapshot snapshot = (MassifSnapshot) ((StructuredSelection) viewer.getSelection()).getFirstElement();
- assertEquals(4, Arrays.asList(snapshots).indexOf(snapshot));
+ Chart control = ((ChartEditor) part).getControl();
+ ILineSeries lsTotal = (ILineSeries) control.getSeriesSet().getSeries(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);
} else {
fail();
}
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/birt/HeapChart.java b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/birt/HeapChart.java
index dde8b0ba43..1e49a5e676 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/birt/HeapChart.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/birt/HeapChart.java
@@ -44,7 +44,7 @@ public class HeapChart {
protected String title;
protected String xUnits;
protected String yUnits;
- protected double [] time, dataUseful, dataExtra, dataStacks, dataTotal;
+ public double [] time, dataUseful, dataExtra, dataStacks, dataTotal;
public HeapChart(MassifSnapshot[] snapshots, String title) {
TimeUnit timeUnit = snapshots[0].getUnit();

Back to the top