diff options
Diffstat (limited to 'valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/tests/ShortcutTest.java')
-rw-r--r-- | valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/tests/ShortcutTest.java | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/tests/ShortcutTest.java b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/tests/ShortcutTest.java index 275eff355b..580602450d 100644 --- a/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/tests/ShortcutTest.java +++ b/valgrind/org.eclipse.linuxtools.valgrind.cachegrind.tests/src/org/eclipse/linuxtools/internal/valgrind/cachegrind/tests/ShortcutTest.java @@ -31,67 +31,67 @@ import org.junit.Test; public class ShortcutTest extends AbstractCachegrindTest { - @Before - public void prep() throws Exception { - proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$ - } - - @Override - @After - public void tearDown() throws CoreException { - deleteProject(proj); - super.tearDown(); - } - - @Test - public void testShortcutSelection() throws Exception { - ValgrindTestCachegrindLaunchShortcut shortcut = new ValgrindTestCachegrindLaunchShortcut(); - - shortcut.launch(new StructuredSelection(proj.getProject()), - ILaunchManager.PROFILE_MODE); - ILaunchConfiguration config = shortcut.getConfig(); - - compareWithDefaults(config); - } - - @Test - public void testShortcutEditor() throws Exception { - ValgrindTestCachegrindLaunchShortcut shortcut = new ValgrindTestCachegrindLaunchShortcut(); - - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - IFile file = proj.getProject().getFile("test.c"); //$NON-NLS-1$ - IEditorPart editor = IDE.openEditor(page, file); - - assertNotNull(editor); - - shortcut.launch(editor, ILaunchManager.PROFILE_MODE); - ILaunchConfiguration config = shortcut.getConfig(); - - compareWithDefaults(config); - } - - @Test - public void testShortcutExistingConfig() throws Exception { - ILaunchConfiguration prev = createConfiguration(proj.getProject()); - - ValgrindTestCachegrindLaunchShortcut shortcut = new ValgrindTestCachegrindLaunchShortcut(); - shortcut.launch(new StructuredSelection(proj.getProject()), - ILaunchManager.PROFILE_MODE); - ILaunchConfiguration current = shortcut.getConfig(); - - assertEquals(prev, current); - } - - private void compareWithDefaults(ILaunchConfiguration config) - throws CoreException { - // tests launch in foreground, this is not typical - ILaunchConfiguration defaults = createConfiguration(proj.getProject()); - ILaunchConfigurationWorkingCopy wc = defaults.getWorkingCopy(); - wc.removeAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND); - wc.doSave(); - - // Compare launch config with defaults - assertEquals(config.getAttributes(), defaults.getAttributes()); - } + @Before + public void prep() throws Exception { + proj = createProjectAndBuild("basicTest"); //$NON-NLS-1$ + } + + @Override + @After + public void tearDown() throws CoreException { + deleteProject(proj); + super.tearDown(); + } + + @Test + public void testShortcutSelection() throws Exception { + ValgrindTestCachegrindLaunchShortcut shortcut = new ValgrindTestCachegrindLaunchShortcut(); + + shortcut.launch(new StructuredSelection(proj.getProject()), + ILaunchManager.PROFILE_MODE); + ILaunchConfiguration config = shortcut.getConfig(); + + compareWithDefaults(config); + } + + @Test + public void testShortcutEditor() throws Exception { + ValgrindTestCachegrindLaunchShortcut shortcut = new ValgrindTestCachegrindLaunchShortcut(); + + IWorkbenchPage page = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage(); + IFile file = proj.getProject().getFile("test.c"); //$NON-NLS-1$ + IEditorPart editor = IDE.openEditor(page, file); + + assertNotNull(editor); + + shortcut.launch(editor, ILaunchManager.PROFILE_MODE); + ILaunchConfiguration config = shortcut.getConfig(); + + compareWithDefaults(config); + } + + @Test + public void testShortcutExistingConfig() throws Exception { + ILaunchConfiguration prev = createConfiguration(proj.getProject()); + + ValgrindTestCachegrindLaunchShortcut shortcut = new ValgrindTestCachegrindLaunchShortcut(); + shortcut.launch(new StructuredSelection(proj.getProject()), + ILaunchManager.PROFILE_MODE); + ILaunchConfiguration current = shortcut.getConfig(); + + assertEquals(prev, current); + } + + private void compareWithDefaults(ILaunchConfiguration config) + throws CoreException { + // tests launch in foreground, this is not typical + ILaunchConfiguration defaults = createConfiguration(proj.getProject()); + ILaunchConfigurationWorkingCopy wc = defaults.getWorkingCopy(); + wc.removeAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND); + wc.doSave(); + + // Compare launch config with defaults + assertEquals(config.getAttributes(), defaults.getAttributes()); + } } |