use of org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode in project linuxtools by eclipse.
the class ExpandCollapseTest method testExpand.
@Test
public void testExpand() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testDefaults");
MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
viewer = view.getTreeViewer().getViewer();
contextMenu = viewer.getTree().getMenu();
// Select first snapshot and expand it
MassifHeapTreeNode[] snapshots = (MassifHeapTreeNode[]) viewer.getInput();
MassifHeapTreeNode snapshot = snapshots[0];
TreeSelection selection = new TreeSelection(new TreePath(new Object[] { snapshot }));
viewer.setSelection(selection);
contextMenu.notifyListeners(SWT.Show, null);
contextMenu.getItem(0).notifyListeners(SWT.Selection, null);
checkExpanded(snapshot, true);
}
use of org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode in project linuxtools by eclipse.
the class ChartTests method testChartLocationsDialog.
@Test
public void testChartLocationsDialog() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testChartCallback");
MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
// peak
MassifSnapshot snapshot = view.getSnapshots()[7];
assertTrue(snapshot.isDetailed());
Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
ChartLocationsDialog dialog = new ChartLocationsDialog(parent);
dialog.setInput(snapshot);
dialog.setBlockOnOpen(false);
dialog.open();
MassifHeapTreeNode element = snapshot.getRoot().getChildren()[1];
dialog.getTableViewer().setSelection(new StructuredSelection(element));
dialog.getOkButton().notifyListeners(SWT.Selection, null);
dialog.openEditorForResult();
checkFile(proj.getProject(), element);
checkLine(element);
}
use of org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode in project linuxtools by eclipse.
the class ExpandCollapseTest method testCollapse.
@Test
public void testCollapse() throws Exception {
// Expand the element first
testExpand();
// Then collapse it
MassifHeapTreeNode[] snapshots = (MassifHeapTreeNode[]) viewer.getInput();
MassifHeapTreeNode snapshot = snapshots[0];
TreeSelection selection = new TreeSelection(new TreePath(new Object[] { snapshot }));
viewer.setSelection(selection);
contextMenu.notifyListeners(SWT.Show, null);
contextMenu.getItem(1).notifyListeners(SWT.Selection, null);
checkExpanded(snapshot, false);
}
use of org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode in project linuxtools by eclipse.
the class TreeTest method testNoDetailed.
@Test
public void testNoDetailed() throws CoreException, URISyntaxException, IOException {
ILaunchConfiguration config = createConfiguration(proj.getProject());
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
// >
wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 12);
// #snapshots
wc.doSave();
// $NON-NLS-1$
doLaunch(config, "testNoDetailed");
MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
TreeViewer treeViewer = view.getTreeViewer().getViewer();
MassifHeapTreeNode[] nodes = (MassifHeapTreeNode[]) treeViewer.getInput();
assertNotNull(nodes);
// should always contain peak
assertEquals(1, nodes.length);
}
use of org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode in project linuxtools by eclipse.
the class TreeTest method testTreeNodes.
@Test
public void testTreeNodes() throws CoreException, URISyntaxException, IOException {
ILaunchConfiguration config = createConfiguration(proj.getProject());
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 2);
wc.doSave();
// $NON-NLS-1$
doLaunch(config, "testTreeNodes");
MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
TreeViewer treeViewer = view.getTreeViewer().getViewer();
MassifSnapshot[] snapshots = view.getSnapshots();
MassifHeapTreeNode[] nodes = (MassifHeapTreeNode[]) treeViewer.getInput();
for (int i = 0; i < nodes.length; i++) {
// every odd snapshot should be detailed with --detailed-freq=2
// and thus in the tree
assertEquals(snapshots[2 * i + 1].getRoot(), nodes[i]);
}
}
Aggregations