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.action;
043:
044: import org.netbeans.jellytools.nodes.Node;
045: import org.netbeans.jellytools.actions.OpenAction;
046: import org.netbeans.jellytools.nodes.SourcePackagesNode;
047:
048: /**
049: * Test of opening files if Editor is already opened.
050: * OpenFiles is used as a base for tests of opening files
051: * when editor is already opened.
052: *
053: * @author mmirilovic@netbeans.org
054: */
055: public class OpenFilesWithOpenedEditor extends OpenFiles {
056:
057: /** Name of file to pre-open */
058: public static String fileName_preopen;
059:
060: /**
061: * Creates a new instance of OpenFilesWithOpenedEditor
062: * @param testName the name of the test
063: */
064: public OpenFilesWithOpenedEditor(String testName) {
065: super (testName);
066: }
067:
068: /**
069: * Creates a new instance of OpenFilesWithOpenedEditor
070: * @param testName the name of the test
071: * @param performanceDataName measured values will be saved under this name
072: */
073: public OpenFilesWithOpenedEditor(String testName,
074: String performanceDataName) {
075: super (testName, performanceDataName);
076: }
077:
078: public void testOpening20kBJavaFile() {
079: WAIT_AFTER_OPEN = 1500;
080: setJavaEditorCaretFilteringOn();
081: fileProject = "PerformanceTestData";
082: filePackage = "org.netbeans.test.performance";
083: fileName = "Main20kB.java";
084: fileName_preopen = "Main.java";
085: menuItem = OPEN;
086: doMeasurement();
087: }
088:
089: public void testOpening20kBTxtFile() {
090: WAIT_AFTER_OPEN = 1000;
091: setPlainTextEditorCaretFilteringOn();
092: fileProject = "PerformanceTestData";
093: filePackage = "org.netbeans.test.performance";
094: fileName = "textfile20kB.txt";
095: fileName_preopen = "textfile.txt";
096: menuItem = OPEN;
097: doMeasurement();
098: }
099:
100: public void testOpening20kBXmlFile() {
101: WAIT_AFTER_OPEN = 1000;
102: setXMLEditorCaretFilteringOn();
103: fileProject = "PerformanceTestData";
104: filePackage = "org.netbeans.test.performance";
105: fileName = "xmlfile20kB.xml";
106: fileName_preopen = "xmlfile.xml";
107: menuItem = EDIT;
108: doMeasurement();
109: }
110:
111: /**
112: * Initialize test - open Main.java file in the Source Editor.
113: */
114: public void initialize() {
115: super .initialize();
116: new OpenAction().performAPI(new Node(new SourcePackagesNode(
117: "PerformanceTestData"),
118: "org.netbeans.test.performance|" + fileName_preopen));
119: }
120:
121: public static void main(java.lang.String[] args) {
122: junit.textui.TestRunner.run(new OpenFilesWithOpenedEditor(
123: "testOpening20kBTxtFile"));
124: }
125:
126: }
|