use of org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart in project linuxtools by eclipse.
the class DoubleClickTest method testDoubleClickFunction.
@Test
public void testDoubleClickFunction() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testDoubleClickFunction");
CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
CachegrindOutput output = view.getOutputs()[0];
// $NON-NLS-1$
CachegrindFile file = getFileByName(output, "cpptest.cpp");
// $NON-NLS-1$
CachegrindFunction func = getFunctionByName(file, "main");
TreePath path = new TreePath(new Object[] { output, file, func });
doDoubleClick(path);
// check file in editor
IEditorPart editor = checkFile(file);
// check line number
ITextEditor textEditor = (ITextEditor) editor;
ISelection selection = textEditor.getSelectionProvider().getSelection();
TextSelection textSelection = (TextSelection) selection;
// zero-indexed
int line = textSelection.getStartLine() + 1;
int expectedLine = ((IFunction) func.getModel()).getSourceRange().getStartLine();
assertEquals(expectedLine, line);
}
use of org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart in project linuxtools by eclipse.
the class DoubleClickTest method testDoubleClickLine.
@Test
public void testDoubleClickLine() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testDoubleClickFunction");
CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
CachegrindOutput output = view.getOutputs()[0];
// $NON-NLS-1$
CachegrindFile file = getFileByName(output, "cpptest.cpp");
// $NON-NLS-1$
CachegrindFunction func = getFunctionByName(file, "main");
CachegrindLine line = func.getLines()[0];
TreePath path = new TreePath(new Object[] { output, file, func });
doDoubleClick(path);
// check file in editor
IEditorPart editor = checkFile(file);
// check line number
ITextEditor textEditor = (ITextEditor) editor;
ISelection selection = textEditor.getSelectionProvider().getSelection();
TextSelection textSelection = (TextSelection) selection;
// zero-indexed
int actualLine = textSelection.getStartLine() + 1;
assertEquals(line.getLine(), actualLine);
}
use of org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart 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");
CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
viewer = view.getViewer();
contextMenu = viewer.getTree().getMenu();
// Select first snapshot and expand it
CachegrindOutput[] outputs = (CachegrindOutput[]) viewer.getInput();
CachegrindOutput output = outputs[0];
TreeSelection selection = new TreeSelection(new TreePath(new Object[] { output }));
viewer.setSelection(selection);
contextMenu.notifyListeners(SWT.Show, null);
contextMenu.getItem(0).notifyListeners(SWT.Selection, null);
checkExpanded(output, true);
}
use of org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart in project linuxtools by eclipse.
the class MultiProcessTest method testNumPids.
@Test
public void testNumPids() throws Exception {
ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy();
config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true);
config.doSave();
// $NON-NLS-1$
doLaunch(config, "testExec");
CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
assertEquals(2, view.getOutputs().length);
}
Aggregations