KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gui > propertyeditors > PropertyType_Properties


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.StringCustomEditorOperator;
23
24 import org.netbeans.jemmy.operators.JEditorPaneOperator;
25
26 import org.netbeans.junit.NbTestSuite;
27
28 /**
29  * Tests of Properties Property Editor.
30  *
31  * @author Marian.Mirilovic@Sun.Com
32  */

33 public class PropertyType_Properties extends PropertyEditorsTest {
34
35     public String JavaDoc propertyName_L;
36     public String JavaDoc propertyValue_L;
37     public String JavaDoc propertyValueExpectation_L;
38
39
40     public boolean waitDialog = false;
41
42     /** Creates a new instance of PropertyType_Properties */
43     public PropertyType_Properties(String JavaDoc testName) {
44         super(testName);
45     }
46     
47     
48     public void setUp(){
49         propertyName_L = "property_Properties";
50         super.setUp();
51     }
52     
53     public static NbTestSuite suite() {
54         NbTestSuite suite = new NbTestSuite();
55         suite.addTest(new PropertyType_Properties("testByInPlace"));
56         suite.addTest(new PropertyType_Properties("verifyCustomizer"));
57         suite.addTest(new PropertyType_Properties("testCustomizerOk"));
58         suite.addTest(new PropertyType_Properties("testCustomizerCancel"));
59         return suite;
60     }
61     
62     public void testCustomizerOk() {
63         propertyValue_L = "propertyName1=propertyValue1";
64         propertyValueExpectation_L = propertyValue_L;
65         waitDialog = false;
66         setByCustomizerOk(propertyName_L, true);
67     }
68     
69     public void testCustomizerCancel(){
70         propertyValue_L = "pp=xx";
71         waitDialog = false;
72         setByCustomizerCancel(propertyName_L, false);
73     }
74     
75     public void testByInPlace(){
76         propertyValue_L = "propertyName=propertyValue";
77         propertyValueExpectation_L = propertyValue_L;
78         waitDialog = false;
79         setByInPlace(propertyName_L, propertyValue_L, true);
80     }
81     
82     public void verifyCustomizer() {
83         verifyCustomizer(propertyName_L);
84     }
85     
86     public void setCustomizerValue() {
87         StringCustomEditorOperator customizer = new StringCustomEditorOperator(propertyCustomizer);
88         //new EventTool().waitNoEvent(3000);
89
//customizer.setStringValue(propertyValue_L);
90
new JEditorPaneOperator(customizer).setText(propertyValue_L);
91     }
92     
93     public void verifyPropertyValue(boolean expectation) {
94         verifyExpectationValue(propertyName_L,expectation, propertyValueExpectation_L, propertyValue_L, waitDialog);
95     }
96     
97     public void verifyCustomizerLayout() {
98         StringCustomEditorOperator customizer = new StringCustomEditorOperator(propertyCustomizer);
99         new JEditorPaneOperator(customizer);
100         customizer.btOK();
101         customizer.btCancel();
102     }
103     
104     /** Test could be executed internaly in Forte without XTest
105      * @param args arguments from command line
106      */

107     public static void main(String JavaDoc[] args) {
108         //junit.textui.TestRunner.run(new NbTestSuite(PropertyType_Properties.class));
109
junit.textui.TestRunner.run(suite());
110     }
111     
112 }
113
Popular Tags