Search in sources :

Example 11 with CachegrindViewPart

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart in project linuxtools by eclipse.

the class CModelLabelsTest method testMethodLabel.

@Test
public void testMethodLabel() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testMethodLabel");
    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, "A::A()");
    assertTrue(func.getModel() instanceof IMethod);
    checkLabelProvider(func, file);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) CachegrindFunction(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFunction) CachegrindViewPart(org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart) IMethod(org.eclipse.cdt.core.model.IMethod) Test(org.junit.Test)

Example 12 with CachegrindViewPart

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart in project linuxtools by eclipse.

the class CModelLabelsTest method testFileLabelsCPP.

@Test
public void testFileLabelsCPP() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testFileLabelsCPP");
    CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    CachegrindOutput output = view.getOutputs()[0];
    // $NON-NLS-1$
    CachegrindFile file = getFileByName(output, "cpptest.cpp");
    assertTrue(file.getModel() instanceof ITranslationUnit);
    checkLabelProvider(file);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) CachegrindViewPart(org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart) ITranslationUnit(org.eclipse.cdt.core.model.ITranslationUnit) Test(org.junit.Test)

Example 13 with CachegrindViewPart

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart 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);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) CachegrindFunction(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFunction) CachegrindViewPart(org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart) IFunction(org.eclipse.cdt.core.model.IFunction) Test(org.junit.Test)

Example 14 with CachegrindViewPart

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart 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);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) CachegrindViewPart(org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart) ITranslationUnit(org.eclipse.cdt.core.model.ITranslationUnit) Test(org.junit.Test)

Example 15 with CachegrindViewPart

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart in project linuxtools by eclipse.

the class CModelLabelsTest method checkLabelProvider.

private static void checkLabelProvider(CachegrindFile file) {
    CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    TreeViewer viewer = view.getViewer();
    TreePath path = new TreePath(new Object[] { view.getOutputs()[0], file });
    checkLabelProvider(viewer, path, file);
}
Also used : TreePath(org.eclipse.jface.viewers.TreePath) AbstractTreeViewer(org.eclipse.jface.viewers.AbstractTreeViewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer) CachegrindViewPart(org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart)

Aggregations

CachegrindViewPart (org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart)19 Test (org.junit.Test)16 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)13 CachegrindOutput (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput)13 CachegrindFile (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile)12 TreePath (org.eclipse.jface.viewers.TreePath)6 CachegrindFunction (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFunction)5 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)3 AbstractTreeViewer (org.eclipse.jface.viewers.AbstractTreeViewer)3 TreeViewer (org.eclipse.jface.viewers.TreeViewer)3 IMethod (org.eclipse.cdt.core.model.IMethod)2 ITranslationUnit (org.eclipse.cdt.core.model.ITranslationUnit)2 TextSelection (org.eclipse.jface.text.TextSelection)2 ISelection (org.eclipse.jface.viewers.ISelection)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)2 IEditorPart (org.eclipse.ui.IEditorPart)2 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)2 IFunction (org.eclipse.cdt.core.model.IFunction)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1