1 19 20 package gui.propertyeditors; 21 22 import java.util.StringTokenizer ; 23 24 import org.netbeans.jemmy.JemmyException; 25 26 import org.netbeans.jellytools.properties.editors.DimensionCustomEditorOperator; 27 28 import org.netbeans.junit.NbTestSuite; 29 30 35 public class PropertyType_Point extends PropertyEditorsTest { 36 37 public String propertyName_L; 38 public String propertyValue_L; 39 public String propertyValueExpectation_L; 40 41 public boolean waitDialog = false; 42 43 44 public PropertyType_Point(String testName) { 45 super(testName); 46 } 47 48 49 public void setUp(){ 50 propertyName_L = "Point"; 51 super.setUp(); 52 } 53 54 public static NbTestSuite suite() { 55 NbTestSuite suite = new NbTestSuite(); 56 suite.addTest(new PropertyType_Point("verifyCustomizer")); 57 suite.addTest(new PropertyType_Point("testCustomizerCancel")); 58 suite.addTest(new PropertyType_Point("testCustomizerOk")); 59 suite.addTest(new PropertyType_Point("testByInPlace")); 60 suite.addTest(new PropertyType_Point("testByInPlaceOneValue")); 61 suite.addTest(new PropertyType_Point("testByInPlaceInvalid")); 62 suite.addTest(new PropertyType_Point("testCustomizerInvalid")); 63 return suite; 64 } 65 66 public void testCustomizerOk() { 67 propertyValue_L = "10, 20"; 68 propertyValueExpectation_L = "["+propertyValue_L+"]"; 69 waitDialog = false; 70 setByCustomizerOk(propertyName_L, true); 71 } 72 73 public void testCustomizerCancel(){ 74 propertyValue_L = "100, 100"; 75 propertyValueExpectation_L = "["+propertyValue_L+"]"; 76 waitDialog = false; 77 setByCustomizerCancel(propertyName_L, false); 78 } 79 80 public void testCustomizerInvalid(){ 81 propertyValue_L = "xx, 20"; 82 propertyValueExpectation_L = "["+propertyValue_L+"]"; 83 waitDialog = true; 84 setByCustomizerOk(propertyName_L, false); 85 } 86 87 public void testByInPlace(){ 88 propertyValue_L = "30, 50"; 89 propertyValueExpectation_L = "["+propertyValue_L+"]"; 90 waitDialog = false; 91 setByInPlace(propertyName_L, propertyValue_L, true); 92 } 93 94 public void testByInPlaceOneValue(){ 95 propertyValue_L = "20"; 96 propertyValueExpectation_L = "["+propertyValue_L+", "+propertyValue_L+"]"; 97 waitDialog = false; 98 setByInPlace(propertyName_L, propertyValue_L, true); 99 } 100 101 public void testByInPlaceInvalid(){ 102 propertyValue_L = "xx Point"; 103 propertyValueExpectation_L = propertyValue_L; 104 waitDialog = true; 105 setByInPlace(propertyName_L, propertyValue_L, false); 106 } 107 108 public void verifyCustomizer() { 109 verifyCustomizer(propertyName_L); 110 } 111 112 public void setCustomizerValue() { 113 DimensionCustomEditorOperator customizer = new DimensionCustomEditorOperator(propertyCustomizer); 114 115 StringTokenizer st = new StringTokenizer (propertyValue_L, ", "); 116 int x = st.countTokens(); 117 118 if(x>2) 119 throw new JemmyException("ERROR: DimensionPointCustomizer.setValue(\""+propertyValue_L+"\") - {number values="+x+"}."); 120 121 customizer.setDimensionValue(st.nextToken(), st.nextToken()); 122 123 } 124 125 public void verifyPropertyValue(boolean expectation) { 126 verifyExpectationValue(propertyName_L,expectation, propertyValueExpectation_L, propertyValue_L, waitDialog); 127 } 128 129 public void verifyCustomizerLayout() { 130 DimensionCustomEditorOperator customizer = new DimensionCustomEditorOperator(propertyCustomizer); 131 customizer.verify(); 132 customizer.btOK(); 133 customizer.btCancel(); 134 } 135 136 139 public static void main(String [] args) { 140 junit.textui.TestRunner.run(suite()); 142 } 143 144 } 145 | Popular Tags |