| 1 19 20 package gui.propertyeditors; 21 22 import org.netbeans.jellytools.properties.ColorProperty; 23 import org.netbeans.jellytools.properties.PropertySheetOperator; 24 25 import org.netbeans.jellytools.properties.editors.ColorCustomEditorOperator; 26 27 import org.netbeans.junit.NbTestSuite; 28 29 34 public class PropertyType_Color extends PropertyEditorsTest { 35 36 public String propertyName_L; 37 public String propertyValue_L; 38 public String propertyValueExpectation_L; 39 40 public boolean waitDialog = false; 41 42 43 public PropertyType_Color(String testName) { 44 super(testName); 45 } 46 47 48 public void setUp(){ 49 propertyName_L = "Color"; 50 super.setUp(); 51 } 52 53 public static NbTestSuite suite() { 54 NbTestSuite suite = new NbTestSuite(); 55 suite.addTest(new PropertyType_Color("verifyCustomizer")); 56 suite.addTest(new PropertyType_Color("testCustomizerCancel")); 57 suite.addTest(new PropertyType_Color("testCustomizerOk")); 58 suite.addTest(new PropertyType_Color("testByInPlace")); 59 suite.addTest(new PropertyType_Color("testByInPlaceInvalid")); 60 return suite; 61 } 62 63 public void testCustomizerOk() { 64 propertyValue_L = "50,50,50"; 65 propertyValueExpectation_L = "["+propertyValue_L+"]"; 66 waitDialog = false; 67 setByCustomizerOk(propertyName_L, true); 68 } 69 70 public void testCustomizerCancel(){ 71 propertyValue_L = "100,100,100"; 72 propertyValueExpectation_L = "["+propertyValue_L+"]"; 73 waitDialog = false; 74 setByCustomizerCancel(propertyName_L, false); 75 } 76 77 public void testByInPlace(){ 78 propertyValue_L = "20,10,100"; 79 propertyValueExpectation_L = "["+propertyValue_L+"]"; 80 waitDialog = false; 81 setByInPlace(propertyName_L, propertyValue_L, true); 82 } 83 84 public void testByInPlaceInvalid(){ 85 propertyValue_L = "xx color"; 86 propertyValueExpectation_L = propertyValue_L; 87 waitDialog = true; 88 setByInPlace(propertyName_L, propertyValue_L, false); 89 } 90 91 public void verifyCustomizer(){ 92 verifyCustomizer(propertyName_L); 93 } 94 95 public void setCustomizerValue() { 96 ColorCustomEditorOperator customizer = new ColorCustomEditorOperator(propertyCustomizer); 97 98 int first_comma = propertyValue_L.indexOf(','); 99 int second_comma = propertyValue_L.indexOf(',',first_comma+1); 100 101 int r = new Integer (propertyValue_L.substring(0,first_comma)).intValue(); 102 int g = new Integer (propertyValue_L.substring(first_comma+1, second_comma)).intValue(); 103 int b = new Integer (propertyValue_L.substring(second_comma+1)).intValue(); 104 105 customizer.setRGBValue(r,g,b); 106 } 107 108 public void verifyPropertyValue(boolean expectation) { 109 verifyExpectationValue(propertyName_L,expectation, propertyValueExpectation_L, propertyValue_L, waitDialog); 110 } 111 112 public String getValue(String propertyName) { 113 String returnValue; 114 PropertySheetOperator propertiesTab = new PropertySheetOperator(propertiesWindow); 115 116 returnValue = new ColorProperty(propertiesTab, propertyName_L).getValue(); 117 err.println("GET VALUE = [" + returnValue + "]."); 118 119 123 return returnValue; 124 } 125 126 public void verifyCustomizerLayout() { 127 ColorCustomEditorOperator customizer = new ColorCustomEditorOperator(propertyCustomizer); 128 customizer.verify(); 129 customizer.btOK(); 130 customizer.btCancel(); 131 } 132 133 136 public static void main(String [] args) { 137 junit.textui.TestRunner.run(suite()); 139 } 140 } 141 | Popular Tags |