001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package gui.windowsystem;
043:
044: import java.io.File;
045: import java.io.PrintStream;
046: import java.io.PrintWriter;
047: import java.io.FileOutputStream;
048:
049: import javax.swing.JMenuBar;
050: import javax.swing.JPopupMenu;
051:
052: import org.netbeans.jellytools.JellyTestCase;
053: import org.netbeans.jellytools.MainWindowOperator;
054: import org.netbeans.jellytools.NbDialogOperator;
055: import org.netbeans.jellytools.OptionsOperator;
056: import org.netbeans.jellytools.ProjectsTabOperator;
057:
058: import org.netbeans.jellytools.actions.DeleteAction;
059: import org.netbeans.jellytools.actions.RenameAction;
060:
061: import org.netbeans.jellytools.nodes.Node;
062: import org.netbeans.jellytools.nodes.SourcePackagesNode;
063:
064: import org.netbeans.jemmy.EventTool;
065: import org.netbeans.jemmy.JemmyException;
066: import org.netbeans.jemmy.JemmyProperties;
067: import org.netbeans.jemmy.TestOut;
068: import org.netbeans.jemmy.operators.JPopupMenuOperator;
069: import org.netbeans.jemmy.operators.JTextFieldOperator;
070: import org.netbeans.jemmy.operators.JTreeOperator;
071:
072: import org.netbeans.junit.NbTestSuite;
073:
074: /**
075: *
076: * @author mmirilovic@netbeans.org
077: */
078: public class MainMenu extends JellyTestCase {
079:
080: protected PrintStream err;
081: protected PrintStream log;
082:
083: private static ProjectsTabOperator projects;
084:
085: private static final String coreBundle = "org.netbeans.core.Bundle";
086: private static final String openideActionsBundle = "org.openide.actions.Bundle";
087:
088: private static final String testProject_name = "SampleProject";
089:
090: private static final String ideConfiguration = fromBundle(
091: coreBundle, "UI/Services/IDEConfiguration"); // IDE Configuration
092: private static final String lookAndFeel = fromBundle(coreBundle,
093: "UI/Services/IDEConfiguration/LookAndFeel"); // Look and Feel
094: private static final String menuBar = fromBundle(coreBundle, "Menu"); // Menu Bar
095: private static final String toolbars = fromBundle(coreBundle,
096: "Toolbars"); // Toolbars
097:
098: private static String lookAndFeelNodeOptions = ideConfiguration
099: + "|" + lookAndFeel;
100: private static String menuBarNodeOptionsPath = lookAndFeelNodeOptions
101: + "|" + menuBar;
102: private static String toolbarsNodeOptions = lookAndFeelNodeOptions
103: + "|" + toolbars;
104: private static String separator = ""; //XXX fromBundle(coreBundle, "CTL_newMenuSeparator"); // Separator
105:
106: private static String versioning = ""; //XXX fromBundleNotTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "Menu/Versioning");
107: private static String versioningMenuBarOptionsNodePath = menuBarNodeOptionsPath
108: + "|" + versioning;
109:
110: private static final String MOVE_UP = "Move Up";
111: private static final String MOVE_DOWN = "Move Down";
112: private static final String SEPARATOR = ""; //XXX "("+separator+")";
113:
114: private JMenuBar mainMenu;
115:
116: private static OptionsOperator options = null;
117:
118: public MainMenu(java.lang.String testName) {
119: super (testName);
120: }
121:
122: public static NbTestSuite suite() {
123:
124: NbTestSuite suite = new NbTestSuite();
125:
126: suite.addTest(new MainMenu("testMainMenuMnemonicsCollision"));
127: suite.addTest(new MainMenu("testMainMenuShortCutCollision"));
128:
129: suite.addTest(new MainMenu("testMenuItemsWhenProjectSelected"));
130: suite.addTest(new MainMenu(
131: "testMenuItemsWhenSourcePackagesSelected"));
132: suite.addTest(new MainMenu("testMenuItemsWhenPackageSelected"));
133: suite.addTest(new MainMenu("testMenuItemsWhenJavaSelected"));
134: suite.addTest(new MainMenu("testMenuItemsWhenFormSelected"));
135:
136: suite.addTest(new MainMenu(
137: "testPopupMenuItemsWhenProjectSelected"));
138: suite.addTest(new MainMenu(
139: "testPopupMenuItemsWhenSourcePackagesSelected"));
140: suite.addTest(new MainMenu(
141: "testPopupMenuItemsWhenPackageSelected"));
142: suite
143: .addTest(new MainMenu(
144: "testPopupMenuItemsWhenJavaSelected"));
145: suite
146: .addTest(new MainMenu(
147: "testPopupMenuItemsWhenFormSelected"));
148: //
149: // suite.addTest(new MainMenu("testAddingNewSeparator"));
150: // suite.addTest(new MainMenu("testMoveUpDownSeparator"));
151: // suite.addTest(new MainMenu("testDeletingSeparator"));
152: // //suite.addTest(new MainMenu("testCutCopyPasteSeparator"));
153: //
154: // suite.addTest(new MainMenu("testAddNewMenu"));
155: // suite.addTest(new MainMenu("testChangeOrderOfMenu"));
156: // //suite.addTest(new MainMenu("testCutCopyPasteMenuItem"));
157: // suite.addTest(new MainMenu("testDeleteMenuItem"));
158: // suite.addTest(new MainMenu("testDeleteMenu"));
159: //
160: // suite.addTest(new MainMenu("testRenameMenu"));
161: //
162: // suite.addTest(new MainMenu("testCreateNewToolbar"));
163: // suite.addTest(new MainMenu("testRenameToolbar"));
164:
165: return suite;
166: }
167:
168: public void setUp() {
169: // err = System.out;
170: err = getLog();
171: log = getRef();
172:
173: try {
174: // set defaults
175: JemmyProperties.getProperties().setOutput(
176: new TestOut(null, new PrintWriter(err, true),
177: new PrintWriter(err, true), null));
178: mainMenu = MainWindowOperator.getDefault().getJMenuBar();
179: projects = new ProjectsTabOperator();
180: } catch (Exception exc) {
181: failTest(exc,
182: "Fail setUp() - maybe MainFrame hasn't menubar");
183: }
184:
185: }
186:
187: public void testMainMenuMnemonicsCollision() {
188: String collisions = MenuChecker.checkMnemonicCollision();
189: assertFalse(collisions, collisions.length() > 0);
190: }
191:
192: public void testMainMenuShortCutCollision() {
193: String collisions = MenuChecker.checkShortCutCollision();
194: assertFalse(collisions, collisions.length() > 0);
195: }
196:
197: public void testMenuItemsWhenProjectSelected() {
198: selectNodeAndCheckMainMenu(projects
199: .getProjectRootNode(testProject_name));
200: }
201:
202: public void testMenuItemsWhenSourcePackagesSelected() {
203: selectNodeAndCheckMainMenu(new SourcePackagesNode(
204: testProject_name));
205: }
206:
207: public void testMenuItemsWhenPackageSelected() {
208: selectNodeAndCheckMainMenu(new Node(new SourcePackagesNode(
209: testProject_name), "sampleproject"));
210: }
211:
212: public void testMenuItemsWhenJavaSelected() {
213: selectNodeAndCheckMainMenu(new Node(new SourcePackagesNode(
214: testProject_name), "sampleproject|JavaFile.java"));
215: }
216:
217: public void testMenuItemsWhenFormSelected() {
218: selectNodeAndCheckMainMenu(new Node(new SourcePackagesNode(
219: testProject_name), "sampleproject|FormFile.java"));
220: }
221:
222: public void testPopupMenuItemsWhenProjectSelected() {
223: selectNodeAndCheckPopupMenu(projects
224: .getProjectRootNode(testProject_name));
225: }
226:
227: public void testPopupMenuItemsWhenSourcePackagesSelected() {
228: selectNodeAndCheckPopupMenu(new SourcePackagesNode(
229: testProject_name));
230: }
231:
232: public void testPopupMenuItemsWhenPackageSelected() {
233: selectNodeAndCheckPopupMenu(new Node(new SourcePackagesNode(
234: testProject_name), "sampleproject"));
235: }
236:
237: public void testPopupMenuItemsWhenJavaSelected() {
238: selectNodeAndCheckPopupMenu(new Node(new SourcePackagesNode(
239: testProject_name), "sampleproject|JavaFile.java"));
240: }
241:
242: public void testPopupMenuItemsWhenFormSelected() {
243: selectNodeAndCheckPopupMenu(new Node(new SourcePackagesNode(
244: testProject_name), "sampleproject|FormFile.java"));
245: }
246:
247: public void testAddingNewSeparator() {
248: new EventTool().waitNoEvent(10);
249:
250: try {
251: openOptions();
252: Node versioningMenuBarOptionsNode = new Node(options
253: .treeTable().tree(),
254: versioningMenuBarOptionsNodePath);
255:
256: versioningMenuBarOptionsNode.performPopupAction(fromBundle(
257: openideActionsBundle, "New")
258: + "|" + separator);
259: new EventTool().waitNoEvent(1000);
260:
261: //check
262: options.selectOption(versioningMenuBarOptionsNodePath + "|"
263: + SEPARATOR);
264: } catch (Exception exc) {
265: failTest(exc, "Exception: " + exc.getMessage() + " arises.");
266: }
267: }
268:
269: public void testMoveUpDownSeparator() {
270: new EventTool().waitNoEvent(10);
271: String initialState, finalState;
272:
273: try {
274: openOptions();
275:
276: String fileNodePath = menuBarNodeOptionsPath + "|"
277: + fromBundleNotTrimmed(coreBundle, "Menu/File");
278:
279: initialState = printChildrenInTreePath(options.treeTable()
280: .tree(), fileNodePath, "|");
281:
282: makeLog(initialState, "Initial State");
283:
284: Node moveNode = new Node(options.treeTable().tree(),
285: fileNodePath + "|" + SEPARATOR);
286:
287: moveNode.performPopupAction(MOVE_DOWN);
288: new EventTool().waitNoEvent(200);
289:
290: moveNode.performPopupAction(MOVE_UP);
291: new EventTool().waitNoEvent(200);
292:
293: moveNode.performPopupAction(MOVE_DOWN);
294: new EventTool().waitNoEvent(200);
295:
296: moveNode.performPopupAction(MOVE_DOWN);
297: new EventTool().waitNoEvent(1000);
298:
299: moveNode.performPopupAction(MOVE_UP);
300: new EventTool().waitNoEvent(200);
301:
302: moveNode.performPopupAction(MOVE_UP);
303: new EventTool().waitNoEvent(200);
304:
305: finalState = printChildrenInTreePath(options.treeTable()
306: .tree(), fileNodePath, "|");
307: makeLog(finalState, "Final State");
308:
309: if (initialState.compareTo(finalState) != 0) {
310: throw new JemmyException(
311: "Initial State of menu {"
312: + fileNodePath
313: + "} isn't the same after change order items operations");
314: }
315:
316: } catch (Exception exc) {
317: failTest(exc, "Exception: " + exc.getMessage() + " arises.");
318: }
319:
320: }
321:
322: public void testDeletingSeparator() {
323: String confirmDeletionTitle = fromBundle(
324: "org.openide.explorer.Bundle",
325: "MSG_ConfirmDeleteObjectTitle"); // Confirm Object Deletion
326: deleteNodeInOptions(SEPARATOR,
327: versioningMenuBarOptionsNodePath, confirmDeletionTitle);
328: }
329:
330: public void testAddNewMenu() {
331: new EventTool().waitNoEvent(10);
332:
333: try {
334: openOptions();
335:
336: Node menuBarOptionsNode = new Node(options.treeTable()
337: .tree(), menuBarNodeOptionsPath);
338:
339: menuBarOptionsNode.performPopupActionNoBlock("Add Menu"); // NOI18N
340:
341: new NbDialogOperator(fromBundle(coreBundle,
342: "CTL_newMenuDialog")).ok();
343: new EventTool().waitNoEvent(200);
344:
345: //check
346: options.selectOption(menuBarNodeOptionsPath + "|"
347: + fromBundle(coreBundle, "CTL_newMenu"));
348: } catch (Exception exc) {
349: failTest(exc, "Exception: " + exc.getMessage() + " arises.");
350: }
351:
352: }
353:
354: public void testChangeOrderOfMenu() {
355: new EventTool().waitNoEvent(100);
356:
357: try {
358: File ref = new File(this .getWorkDir(),
359: "InfoAboutMenu.check");
360: File golden = new File(this .getWorkDir(),
361: "InfoAboutMenu.gold");
362:
363: openOptions();
364:
365: String moveNodePath = menuBarNodeOptionsPath + "|"
366: + fromBundleNotTrimmed(coreBundle, "Menu/File");
367: Node moveNode = new Node(options.treeTable().tree(),
368: moveNodePath);
369:
370: new PrintStream(new FileOutputStream(golden))
371: .println(printChildrenInTreePath(options
372: .treeTable().tree(),
373: menuBarNodeOptionsPath, "|"));
374: err.println("\n ======= BEFORE : \n "
375: + printChildrenInTreePath(options.treeTable()
376: .tree(), menuBarNodeOptionsPath, "|")
377: + " \n =============");
378:
379: moveNode.performPopupAction(MOVE_DOWN);
380: new EventTool().waitNoEvent(200);
381:
382: moveNode.performPopupAction(MOVE_UP);
383: new EventTool().waitNoEvent(200);
384:
385: moveNode.performPopupAction(MOVE_DOWN);
386: new EventTool().waitNoEvent(200);
387:
388: moveNode.performPopupAction(MOVE_UP);
389: new EventTool().waitNoEvent(200);
390:
391: new PrintStream(new FileOutputStream(ref))
392: .println(printChildrenInTreePath(options
393: .treeTable().tree(),
394: menuBarNodeOptionsPath, "|"));
395: err.println("\n ======= AFTER : \n "
396: + printChildrenInTreePath(options.treeTable()
397: .tree(), menuBarNodeOptionsPath, "|")
398: + " \n =============");
399:
400: assertFile(
401: "Menu before and after isn't the same and it should be",
402: ref, golden, this .getWorkDir());
403:
404: //log(printChildrenInTreePath(options.getJTreeOperator(), menuBarNodeOptionsPath,options.delim));
405: //log.println(printChildrenInTreePath(options.getJTreeOperator(), menuBarNodeOptionsPath,options.delim));
406:
407: //compareReferenceFiles();
408:
409: } catch (Exception exc) {
410: failTest(exc, "Exception: " + exc.getMessage() + " arises.");
411: }
412:
413: }
414:
415: public void testDeleteMenuItem() {
416: String file = fromBundleNotTrimmed(coreBundle, "Menu/File");
417: String confirmDeletionTitle = fromBundle(
418: "org.openide.explorer.Bundle",
419: "MSG_ConfirmDeleteObjectTitle"); // Confirm Object Deletion
420: deleteNodeInOptions("Pa&ge Setup", menuBarNodeOptionsPath + "|"
421: + file, confirmDeletionTitle); //NOI18N
422: }
423:
424: public void testDeleteMenu() {
425: String confirmDeletionTitle = fromBundle(
426: "org.openide.explorer.Bundle",
427: "MSG_ConfirmDeleteObjectTitle"); // Confirm Object Deletion
428: String menuXX = fromBundle(coreBundle, "CTL_newMenuName"); // Menu
429: deleteNodeInOptions(menuXX, menuBarNodeOptionsPath,
430: confirmDeletionTitle);
431: }
432:
433: public void testRenameMenu() {
434: String build = fromBundleNotTrimmed(coreBundle, "Menu/Build"); // &Build
435: renameNodeInOptions(menuBarNodeOptionsPath, build, "TestMenu");
436: }
437:
438: public void testCreateNewToolbar() {
439: new EventTool().waitNoEvent(100);
440:
441: try {
442: openOptions();
443:
444: new Node(options.treeTable().tree(), toolbarsNodeOptions)
445: .performPopupActionNoBlock("Add Toolbar"); //NOI18N
446:
447: new NbDialogOperator("New Toolbar").ok(); //NOI18N
448: new EventTool().waitNoEvent(200);
449:
450: //check
451: options.selectOption(toolbarsNodeOptions + "|Toolbar");
452: } catch (Exception exc) {
453: failTest(exc, "Exception: " + exc.getMessage() + " arises.");
454: }
455: }
456:
457: public void testRenameToolbar() {
458: String build = fromBundleNotTrimmed(coreBundle,
459: "Toolbars/Build"); // Build
460: renameNodeInOptions(toolbarsNodeOptions, build, "TestBuild");
461: }
462:
463: private void renameNodeInOptions(String parentNodeName,
464: String oldNodeName, String newNodeName) {
465: new EventTool().waitNoEvent(100);
466:
467: try {
468: openOptions();
469:
470: Node renamedNode = new Node(options.treeTable().tree(),
471: parentNodeName + "|" + oldNodeName);
472: new RenameAction().performPopup(renamedNode);
473:
474: String rename = fromBundle(openideActionsBundle,
475: "CTL_RenameTitle"); // Rename
476: NbDialogOperator renameDialog = new NbDialogOperator(rename);
477: JTextFieldOperator dialogTextField = new JTextFieldOperator(
478: renameDialog, 0);
479: dialogTextField.setText(newNodeName);
480: String realNewName = dialogTextField.getText();
481: renameDialog.ok();
482:
483: log("=========================== New name is {"
484: + realNewName + "}.");
485:
486: new EventTool().waitNoEvent(300);
487:
488: options.selectOption(parentNodeName + "|" + realNewName);
489:
490: } catch (Exception exc) {
491: failTest(exc, "Exception: " + exc.getMessage() + " arises.");
492: }
493: }
494:
495: private void deleteNodeInOptions(String nodeName,
496: String parentNode, String confirmationDialogTitle) {
497: boolean ariseJemmyException = false;
498: String deleteNodePath = parentNode + "|" + nodeName;
499:
500: try {
501: openOptions();
502:
503: Node deleteNode = new Node(options.treeTable().tree(),
504: deleteNodePath);
505: new DeleteAction().performPopup(deleteNode);
506:
507: closeConfirmDialog(confirmationDialogTitle);
508:
509: // node needn't be there, JemmyException have to arise !!!
510: try {
511: options.selectOption(deleteNodePath);
512: } catch (JemmyException ex) {//ok
513: ariseJemmyException = true;
514: }
515:
516: if (!ariseJemmyException)
517: fail("Nonexpected node {" + nodeName
518: + "} is under node {" + deleteNode + "}.");
519:
520: } catch (Exception exc) {
521: failTest(exc, "Exception: " + exc.getMessage() + " arises.");
522: }
523:
524: }
525:
526: protected void selectNodeAndCheckMainMenu(Node nodeToSelect) {
527: err.println("=========== try to select node ["
528: + nodeToSelect.getPath() + "].");
529:
530: nodeToSelect.select();
531:
532: new EventTool().waitNoEvent(100);
533: MenuChecker.visitMenuBar(mainMenu);
534:
535: String file = fromBundle(coreBundle, "Menu/File"); // File
536: String edit = fromBundle(coreBundle, "Menu/Edit"); // Edit
537: String build = fromBundle(coreBundle, "Menu/Build"); // Build
538:
539: MenuChecker.printMenuBarStructure(mainMenu, log, file + ", "
540: + edit + ", " + build, true, true);
541:
542: compareReferenceFiles();
543: }
544:
545: protected void selectNodeAndCheckPopupMenu(Node nodeToSelect) {
546: err.println("=========== try to select node ["
547: + nodeToSelect.getPath() + "].");
548:
549: nodeToSelect.select();
550:
551: JPopupMenuOperator popupOperator = nodeToSelect.callPopup();
552: new EventTool().waitNoEvent(500);
553: JPopupMenu popup = (JPopupMenu) popupOperator.getSource();
554:
555: String tools = fromBundle(coreBundle, "Menu/Tools"); // Tools
556: MenuChecker.printPopupMenuStructure(popup, log, tools, true,
557: true);
558: //MenuChecker.printPopupMenuStructure(popup, System.out, "Tools", true, true);
559:
560: if (popupOperator != null)
561: popupOperator.pressKey(java.awt.event.KeyEvent.VK_ESCAPE);
562:
563: //popup.setVisible(false);
564:
565: compareReferenceFiles();
566: }
567:
568: protected String printChildrenInTreePath(JTreeOperator operator,
569: String path, String delim) {
570: StringBuffer buffer = new StringBuffer("");
571:
572: operator.expandPath(operator.findPath(path, delim));
573: javax.swing.tree.TreePath children[] = operator
574: .getChildPaths(operator.findPath(path, delim));
575:
576: for (int i = 0; i < children.length; i++) {
577: buffer.append("\n" + children[i].toString());
578: }
579:
580: return buffer.toString();
581: }
582:
583: private void closeConfirmDialog(String title) {
584: new NbDialogOperator(title).yes();
585: new EventTool().waitNoEvent(1000);
586: }
587:
588: private void makeLog(String logString, String logTitle) {
589: log("---------- " + logTitle + " >>>>>>>");
590: log(logString);
591: log(">>>>>>>>>> " + logTitle + " -------");
592: }
593:
594: /** Print full stack trace to log files, get message and log to test results if test fails.
595: * @param exc Exception logged to description
596: * @param message written to test results
597: */
598: private void failTest(Exception exc, String message) {
599: try {
600: getWorkDir();
601: org.netbeans.jemmy.util.PNGEncoder
602: .captureScreen(getWorkDirPath()
603: + System.getProperty("file.separator")
604: + "IDEscreenshot.png");
605: } catch (Exception ioexc) {
606: log("Impossible make IDE screenshot!!! \n"
607: + ioexc.toString());
608: }
609:
610: err.println("################################");
611: exc.printStackTrace(err);
612: err.println("################################");
613: fail(message);
614: }
615:
616: /*
617: public void testCutCopyPasteSeparator() throws java.io.IOException {
618: err.println("=========================== "+getName()+" #######");
619: Options.show();
620: Options options = Options.find();
621: String delim = JettyTreePropertiesWindow.delim;
622:
623: options.pushPopupMenu("Copy",
624: menuBarNodeOptionsPath + options.delim +"&File"+delim+SEPARATOR);
625: options.pushPopupMenu("Paste|Copy",
626: menuBarNodeOptionsPath + options.delim +"&Edit");
627: options.pushPopupMenu("Cut",
628: menuBarNodeOptionsPath + options.delim +"&File"+delim+SEPARATOR);
629: options.pushPopupMenu("Paste",
630: menuBarNodeOptionsPath + options.delim +"&Edit");
631: //capture Option
632: WindowSystemSupport.makeWindowScreenshot(this, options.getComponent(), "Options");
633: //print to ref
634: ref("---File---");
635: log(printChildrenInTreePath(options.getJTreeOperator(), menuBarNodeOptionsPath + options.delim +"&File", options.delim));
636: ref("---Edit---");
637: log(printChildrenInTreePath(options.getJTreeOperator(), menuBarNodeOptionsPath + options.delim +"&Edit", options.delim));
638: compareReferenceFiles();
639: }
640: */
641: /*
642: public void testCutCopyPasteMenuItem() throws java.io.IOException {
643: err.println("=========================== "+getName()+" #######");
644: Options.show();
645: Options options = Options.find();
646:
647: options.pushPopupMenu("Copy",new String[]{menuBarNodeOptionsPath + options.delim + "&View" + options.delim + SEPARATOR, menuBarNodeOptionsPath + options.delim + "&View" + options.delim + "&Properties"});
648: options.pushPopupMenu("Paste|Copy", menuBarNodeOptionsPath + options.delim + "Menu");
649: options.pushPopupMenu("Cut", menuBarNodeOptionsPath + options.delim + "&View" + options.delim + "&Explorer");
650: options.pushPopupMenu("Paste", menuBarNodeOptionsPath + options.delim + "Menu");
651: //capture Option
652: WindowSystemSupport.makeWindowScreenshot(this, options.getComponent(), "Options");
653: //print to ref
654: ref("---View---");
655: log(printChildrenInTreePath(options.getJTreeOperator(), menuBarNodeOptionsPath + options.delim + "&View", log, options.delim));
656: ref("---Menu---");
657: log(printChildrenInTreePath(options.getJTreeOperator(), menuBarNodeOptionsPath + options.delim + "Menu", log, options.delim));
658: compareReferenceFiles();
659: }
660: */
661:
662: private static void openOptions() {
663: if (options == null) {
664: options = OptionsOperator.invoke();
665: new EventTool().waitNoEvent(500);
666: }
667:
668: }
669:
670: private static String fromBundle(String bundle, String key) {
671: return org.netbeans.jellytools.Bundle.getStringTrimmed(bundle,
672: key);
673: }
674:
675: private static String fromBundleNotTrimmed(String bundle, String key) {
676: return org.netbeans.jellytools.Bundle.getString(bundle, key);
677: }
678:
679: public static void main(java.lang.String[] args) {
680: junit.textui.TestRunner.run(suite());
681: }
682: }
|