KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gui > propertyeditors > PropertyType_IndentEngine


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package gui.propertyeditors;
21
22 import org.netbeans.jellytools.properties.editors.ServiceTypeCustomEditorOperator;
23
24 import org.netbeans.junit.NbTestSuite;
25
26
27 /**
28  * Tests of Indent Engine Property Editor.
29  *
30  * @author Marian.Mirilovic@Sun.Com
31  */

32 public class PropertyType_IndentEngine extends PropertyEditorsTest {
33
34     public String JavaDoc propertyName_L;
35     public String JavaDoc propertyValue_L;
36     public String JavaDoc propertyValueExpectation_L;
37
38     public boolean waitDialog = false;
39
40     /** Creates a new instance of PropertyType_IndentEngine */
41     public PropertyType_IndentEngine(String JavaDoc testName) {
42         super(testName);
43     }
44     
45     
46     public void setUp(){
47         propertyName_L = "Indent Engine";
48         super.setUp();
49     }
50     
51     public static NbTestSuite suite() {
52         NbTestSuite suite = new NbTestSuite();
53         suite.addTest(new PropertyType_IndentEngine("testByCombo"));
54         suite.addTest(new PropertyType_IndentEngine("verifyCustomizer"));
55         suite.addTest(new PropertyType_IndentEngine("testCustomizerOk"));
56         suite.addTest(new PropertyType_IndentEngine("testCustomizerCancel"));
57         return suite;
58     }
59     
60     public void testByCombo(){
61         propertyValue_L = org.netbeans.jellytools.Bundle.getStringTrimmed("org.netbeans.beaninfo.Bundle", "LAB_IndentEngineDefault"); // No Indentation
62
propertyValueExpectation_L = propertyValue_L;
63         waitDialog = false;
64         setByCombo(propertyName_L, propertyValue_L, true);
65     }
66     
67     public void testCustomizerOk(){
68         propertyValue_L = org.netbeans.jellytools.Bundle.getStringTrimmed("org.netbeans.modules.editor.java.Bundle", "LAB_JavaIndentEngine"); // Java Indentation Engine
69
propertyValueExpectation_L = propertyValue_L;
70         waitDialog = false;
71         setByCustomizerOk(propertyName_L, true);
72     }
73     
74     public void testCustomizerCancel(){
75         propertyValue_L = org.netbeans.jellytools.Bundle.getStringTrimmed("org.netbeans.modules.editor.options.Bundle", "LAB_SimpleIndentEngine"); // Simple Indentation Engine
76
propertyValueExpectation_L = propertyValue_L;
77         waitDialog = false;
78         setByCustomizerCancel(propertyName_L, false);
79     }
80     
81     public void testCustomizerOk_platform(){
82         propertyValue_L = org.netbeans.jellytools.Bundle.getStringTrimmed("org.netbeans.beaninfo.Bundle", "LAB_IndentEngineDefault"); // No Indentation
83
propertyValueExpectation_L = propertyValue_L;
84         waitDialog = false;
85         setByCustomizerOk(propertyName_L, true);
86     }
87     
88     public void testCustomizerCancel_platform(){
89         propertyValue_L = org.netbeans.jellytools.Bundle.getStringTrimmed("org.netbeans.beaninfo.Bundle", "LAB_IndentEngineDefault"); // No Indentation
90
propertyValueExpectation_L = propertyValue_L;
91         waitDialog = false;
92         setByCustomizerCancel(propertyName_L, false);
93     }
94     
95     public void verifyCustomizer() {
96         verifyCustomizer(propertyName_L);
97     }
98     
99     public void setCustomizerValue() {
100         ServiceTypeCustomEditorOperator customizer = new ServiceTypeCustomEditorOperator(propertyCustomizer);
101         customizer.setServiceTypeValue(propertyValue_L);
102     }
103     
104     public void verifyPropertyValue(boolean expectation) {
105         verifyExpectationValue(propertyName_L,expectation, propertyValueExpectation_L, propertyValue_L, false);
106     }
107     
108     public void verifyCustomizerLayout() {
109         ServiceTypeCustomEditorOperator customizer = new ServiceTypeCustomEditorOperator(propertyCustomizer);
110         customizer.lstServices();
111         customizer.propertySheet();
112         customizer.btOK();
113         customizer.btCancel();
114     }
115     
116     /** Test could be executed internaly in Forte without XTest
117      * @param args arguments from command line
118      */

119     public static void main(String JavaDoc[] args) {
120         //junit.textui.TestRunner.run(new NbTestSuite(PropertyType_IndentEngine.class));
121
junit.textui.TestRunner.run(suite());
122     }
123     
124 }
125
Popular Tags