Search in sources :

Example 1 with MassifHeapTreeNode

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);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) MassifHeapTreeNode(org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode) TreePath(org.eclipse.jface.viewers.TreePath) TreeSelection(org.eclipse.jface.viewers.TreeSelection) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 2 with MassifHeapTreeNode

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);
}
Also used : ChartLocationsDialog(org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartLocationsDialog) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) Shell(org.eclipse.swt.widgets.Shell) MassifHeapTreeNode(org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode) MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 3 with MassifHeapTreeNode

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);
}
Also used : MassifHeapTreeNode(org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode) TreePath(org.eclipse.jface.viewers.TreePath) TreeSelection(org.eclipse.jface.viewers.TreeSelection) Test(org.junit.Test)

Example 4 with MassifHeapTreeNode

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);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) MassifHeapTreeNode(org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 5 with MassifHeapTreeNode

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]);
    }
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) MassifHeapTreeNode(org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode) TreeViewer(org.eclipse.jface.viewers.TreeViewer) MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Aggregations

MassifHeapTreeNode (org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode)6 Test (org.junit.Test)5 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)4 MassifViewPart (org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart)4 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)2 TreePath (org.eclipse.jface.viewers.TreePath)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 MassifSnapshot (org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 ChartLocationsDialog (org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartLocationsDialog)1 Shell (org.eclipse.swt.widgets.Shell)1