1
/*******************************************************************************
2
* Copyright (c) 2008, 2009 Red Hat, Inc.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Elliott Baron <ebaron@redhat.com> - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.linuxtools.internal.valgrind.massif.tests;
14
import org.eclipse.debug.core.ILaunchConfiguration;
15
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
16
import org.eclipse.jface.viewers.DoubleClickEvent;
17
import org.eclipse.jface.viewers.IDoubleClickListener;
18
import org.eclipse.jface.viewers.TreePath;
19
import org.eclipse.jface.viewers.TreeSelection;
20
import org.eclipse.jface.viewers.TreeViewer;
21
import org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode;
22
import org.eclipse.linuxtools.internal.valgrind.massif.MassifLaunchConstants;
23
import org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot;
24
import org.eclipse.linuxtools.internal.valgrind.massif.MassifTreeViewer;
25
import org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart;
26
import org.eclipse.linuxtools.internal.valgrind.ui.ValgrindUIPlugin;
28
public class DoubleClickTest extends AbstractMassifTest {
29
private MassifHeapTreeNode node;
32
protected void setUp() throws Exception {
34
proj = createProjectAndBuild("alloctest"); //$NON-NLS-1$
38
protected void tearDown() throws Exception {
43
private void doDoubleClick() {
44
MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
45
MassifTreeViewer treeViewer = view.getTreeViewer();
47
MassifSnapshot[] snapshots = view.getSnapshots();
48
node = snapshots[1].getRoot(); // first detailed
49
TreePath path = new TreePath(new Object[] { node });
50
while (node.getChildren().length > 0 && !node.hasSourceFile()) {
51
node = node.getChildren()[0];
52
path = path.createChildPath(node);
54
if (node.hasSourceFile()) {
55
treeViewer.getViewer().expandToLevel(node, TreeViewer.ALL_LEVELS);
56
TreeSelection selection = new TreeSelection(path);
59
IDoubleClickListener listener = treeViewer.getDoubleClickListener();
60
listener.doubleClick(new DoubleClickEvent(treeViewer.getViewer(), selection));
67
public void testDoubleClickFile() throws Exception {
68
ILaunchConfiguration config = createConfiguration(proj.getProject());
69
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
70
wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 2);
72
doLaunch(config, "testDoubleClickFile"); //$NON-NLS-1$
76
checkFile(proj.getProject(), node);
79
public void testDoubleClickLine() throws Exception {
80
ILaunchConfiguration config = createConfiguration(proj.getProject());
81
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
82
wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 2);
84
doLaunch(config, "testDoubleClickLine"); //$NON-NLS-1$