KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gui > propertyeditors > PropertyType_File


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 gui.propertyeditors.utilities.CoreSupport;
23 import org.netbeans.jellytools.properties.editors.FileCustomEditorOperator;
24
25 import org.netbeans.jemmy.EventTool;
26
27 import org.netbeans.junit.NbTestSuite;
28
29
30 /**
31  * Tests of File Property Editor.
32  *
33  * @author Marian.Mirilovic@Sun.Com
34  */

35 public class PropertyType_File extends PropertyEditorsTest {
36
37     public String JavaDoc propertyName_L;
38     public String JavaDoc propertyValue_L;
39     public String JavaDoc propertyValueExpectation_L;
40
41     public boolean waitDialog = false;
42
43     /** Creates a new instance of PropertyType_Boolean */
44     public PropertyType_File(String JavaDoc testName) {
45         super(testName);
46     }
47     
48     public void setUp(){
49         propertyName_L = "File";
50         propertyValue_L = new java.io.File JavaDoc(CoreSupport.getSampleProjectPath(this),"build.xml").getPath();
51         log("=========== File to be set {"+propertyValue_L+"}");
52         super.setUp();
53     }
54     
55     public static NbTestSuite suite() {
56         NbTestSuite suite = new NbTestSuite();
57         suite.addTest(new PropertyType_File("verifyCustomizer"));
58         suite.addTest(new PropertyType_File("testByInPlace"));
59         suite.addTest(new PropertyType_File("testCustomizerCancel"));
60         suite.addTest(new PropertyType_File("testCustomizerOk"));
61         return suite;
62     }
63     
64     public void testCustomizerOk() {
65         propertyValueExpectation_L = propertyValue_L;
66         waitDialog = false;
67         setByCustomizerOk(propertyName_L, true);
68     }
69     
70     public void testCustomizerCancel(){
71         propertyValueExpectation_L = propertyValue_L;
72         waitDialog = false;
73         setByCustomizerCancel(propertyName_L, false);
74     }
75     
76     public void testByInPlace(){
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         FileCustomEditorOperator customizer = new FileCustomEditorOperator(propertyCustomizer);
88         new EventTool().waitNoEvent(1000);
89         customizer.setFileValue(propertyValue_L);
90     }
91     
92     public void verifyPropertyValue(boolean expectation) {
93         verifyExpectationValue(propertyName_L,expectation, propertyValueExpectation_L, propertyValue_L, waitDialog);
94     }
95     
96     public void verifyCustomizerLayout() {
97         FileCustomEditorOperator customizer = new FileCustomEditorOperator(propertyCustomizer);
98         customizer.verify();
99         customizer.btOK();
100         customizer.btCancel();
101     }
102     
103     /** Test could be executed internaly in Forte without XTest
104      * @param args arguments from command line
105      */

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