|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.test.debugger.basic; import org.openide.filesystems.FileObject; import org.openide.filesystems.Repository; /** * Test on presence of menus. * * @author Jan Stola */ public class MenusPresenceTestCase extends org.netbeans.junit.NbTestCase { private static final String MENU_VIEW="View"; private static final String MENUITEM_DEBUGGER_WINDOW="org-netbeans-modules-debugger-support-actions-DebuggerWindowAction"; private static final String MENU_PROJECT="Project"; private static final String MENUITEM_DEBUG_PROJECT="org-netbeans-modules-projects-actions-DebugProjectAction"; private static final String MENU_DEBUG="Debug"; private static final String MENUITEM_START="org-netbeans-modules-debugger-support-actions-StartAction"; private static final String MENUITEM_FINISH="org-netbeans-modules-debugger-support-actions-FinishAction"; private static final String MENUITEM_ATTACH="org-netbeans-modules-debugger-support-actions-ConnectAction"; private static final String MENUITEM_CONTINUE="org-netbeans-modules-debugger-support-actions-ContinueAction"; private static final String MENUITEM_PAUSE="org-netbeans-modules-debugger-support-actions-PauseAction"; private static final String MENUITEM_RUN_TO_CURSOR="org-netbeans-modules-debugger-support-actions-RunToCursorAction"; private static final String MENUITEM_STEP_OVER="org-netbeans-modules-debugger-support-actions-StepOverAction"; private static final String MENUITEM_STEP_INTO="org-netbeans-modules-debugger-support-actions-StepIntoAction"; private static final String MENUITEM_STEP_OUT="org-netbeans-modules-debugger-support-actions-StepOutAction"; private static final String MENUITEM_TOGGLE_BREAKPOINT="org-netbeans-modules-debugger-support-actions-ToggleBreakpointAction"; private static final String MENUITEM_ADD_BREAKPOINT="org-netbeans-modules-debugger-support-actions-AddBreakpointAction"; private static final String MENUITEM_ADD_WATCH="org-netbeans-modules-debugger-support-actions-AddWatchAction"; private static final String MENUITEM_GO_TO_CALLED="org-netbeans-modules-debugger-support-actions-GoToCalledMethodAction"; private static final String MENUITEM_GO_TO_CALLING="org-netbeans-modules-debugger-support-actions-GoToCallingMethodAction"; private static final String MENUITEM_FIX="org-netbeans-modules-debugger-support-actions-FixAction"; private static final String MENUITEM_POP_TOPMOST_FRAME="org-netbeans-modules-debugger-support-actions-PopTopmostFrameAction"; private static final String DATAFOLDER_STARTSESSION="StartSession"; private static final String DATAFOLDER_STACK="Stack"; public MenusPresenceTestCase(String name) { super(name); } public void testViewMenu() { getMenu(MENU_VIEW); } public void testDebuggerWindowInView() { getMenuItem(getMenu(MENU_VIEW), MENUITEM_DEBUGGER_WINDOW); } public void testProjectMenu() { getMenu(MENU_PROJECT); } public void testDebugProject() { getMenuItem(getMenu(MENU_PROJECT), MENUITEM_DEBUG_PROJECT); } public void testDebugMenu() { getMenu(MENU_DEBUG); } public void testStart() { FileObject dataFolder = getMenuItem(getMenu(MENU_DEBUG), DATAFOLDER_STARTSESSION); getMenuItem(dataFolder, MENUITEM_START); } public void testFinish() { getMenuItem(getMenu(MENU_DEBUG), MENUITEM_FINISH); } public void testAttach() { FileObject dataFolder = getMenuItem(getMenu(MENU_DEBUG), DATAFOLDER_STARTSESSION); getMenuItem(dataFolder, MENUITEM_ATTACH); // getMenuItem(getMenu(MENU_DEBUG), MENUITEM_ATTACH); } public void testContinue() { getMenuItem(getMenu(MENU_DEBUG), MENUITEM_CONTINUE); } public void testPause() { getMenuItem(getMenu(MENU_DEBUG), MENUITEM_PAUSE); } public void testRunToCursor() { getMenuItem(getMenu(MENU_DEBUG), MENUITEM_RUN_TO_CURSOR); } public void testStepOver() { getMenuItem(getMenu(MENU_DEBUG), MENUITEM_STEP_OVER); } public void testStepInto() { getMenuItem(getMenu(MENU_DEBUG), MENUITEM_STEP_INTO); } public void testStepOut() { getMenuItem(getMenu(MENU_DEBUG), MENUITEM_STEP_OUT); } public void testFix() { getMenuItem(getMenu(MENU_DEBUG), MENUITEM_FIX); } public void testGoToCalled() { FileObject dataFolder = getMenuItem(getMenu(MENU_DEBUG), DATAFOLDER_STACK); getMenuItem(dataFolder, MENUITEM_GO_TO_CALLED); } public void testGoToCalling() { FileObject dataFolder = getMenuItem(getMenu(MENU_DEBUG), DATAFOLDER_STACK); getMenuItem(dataFolder, MENUITEM_GO_TO_CALLING); } public void testPopTopmostFrame() { FileObject dataFolder = getMenuItem(getMenu(MENU_DEBUG), DATAFOLDER_STACK); getMenuItem(dataFolder, MENUITEM_POP_TOPMOST_FRAME); } // public void testToggleBreakpoint() { // getMenuItem(getMenu(MENU_DEBUG), MENUITEM_TOGGLE_BREAKPOINT); // } public void testAddBreakpoint() { getMenuItem(getMenu(MENU_DEBUG), MENUITEM_ADD_BREAKPOINT); } public void testAddWatch() { getMenuItem(getMenu(MENU_DEBUG), MENUITEM_ADD_WATCH); } // public void testDebuggerWindow() { // getMenuItem(getMenu(MENU_DEBUG), MENUITEM_DEBUGGER_WINDOW); // } public FileObject getMenu(String folder) { int i; FileObject actionsFolder = Repository.getDefault().findResource("Menu"); FileObject[] actionsSubFolders = actionsFolder.getChildren(); for (i = 0; i < actionsSubFolders.length; i++) { if (folder.equals(actionsSubFolders[i].getName())) return actionsSubFolders[i]; } assertTrue(folder+" folder cannot be found.", false); return null; } public FileObject getMenuItem(FileObject folder, String action) { int i; FileObject[] actionsList=folder.getChildren(); for (i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.