use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput in project linuxtools by eclipse.
the class CModelLabelsTest method testFunctionLabel.
@Test
public void testFunctionLabel() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testFunctionLabel");
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");
assertTrue(func.getModel() instanceof IFunction);
checkLabelProvider(func, file);
}
use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput in project linuxtools by eclipse.
the class CModelLabelsTest method testFileLabelsH.
@Test
public void testFileLabelsH() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testFileLabelsH");
CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
CachegrindOutput output = view.getOutputs()[0];
// $NON-NLS-1$
CachegrindFile file = getFileByName(output, "cpptest.h");
assertTrue(file.getModel() instanceof ITranslationUnit);
assertTrue(((ITranslationUnit) file.getModel()).isHeaderUnit());
checkLabelProvider(file);
}
use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput 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.model.CachegrindOutput 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.model.CachegrindOutput 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);
}
Aggregations