1 19 20 package gui.propertyeditors; 21 22 import org.netbeans.jellytools.properties.FontProperty; 23 import org.netbeans.jellytools.properties.PropertySheetOperator; 24 25 import org.netbeans.jellytools.properties.editors.FontCustomEditorOperator; 26 27 import org.netbeans.junit.NbTestSuite; 28 29 34 public class PropertyType_Font 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_Font(String testName) { 44 super(testName); 45 } 46 47 48 public void setUp(){ 49 propertyName_L = "Font"; 50 super.setUp(); 51 } 52 53 public static NbTestSuite suite() { 54 NbTestSuite suite = new NbTestSuite(); 55 suite.addTest(new PropertyType_Font("verifyCustomizer")); 56 suite.addTest(new PropertyType_Font("testCustomizerCancel")); 57 suite.addTest(new PropertyType_Font("testCustomizerOk")); 58 suite.addTest(new PropertyType_Font("testCustomizerOkUnknownSize")); 59 suite.addTest(new PropertyType_Font("testCustomizerInvalid")); 60 return suite; 61 } 62 63 public void testCustomizerOk() { 64 propertyValue_L = "Monospaced, 10, Bold"; 65 propertyValueExpectation_L = "Monospaced 10 Bold"; 66 waitDialog = false; 67 setByCustomizerOk(propertyName_L, true); 68 } 69 70 public void testCustomizerOkUnknownSize() { 71 propertyValue_L = "Monospaced, 13, Bold"; 72 propertyValueExpectation_L = "Monospaced 13 Bold"; 73 waitDialog = false; 74 setByCustomizerOk(propertyName_L, true); 75 } 76 77 public void testCustomizerCancel(){ 78 propertyValue_L = "Monospaced, 100, Bold"; 79 propertyValueExpectation_L = "Monospaced 100 Bold"; 80 waitDialog = false; 81 setByCustomizerCancel(propertyName_L, false); 82 } 83 84 public void testCustomizerInvalid(){ 85 propertyValue_L = "Monospaced, xx, Bold Italic"; 86 propertyValueExpectation_L = "Monospaced xx Bold Italic"; 87 waitDialog = false; 88 setByCustomizerOk(propertyName_L, false); 89 } 90 91 public void verifyCustomizer() { 92 verifyCustomizer(propertyName_L); 93 } 94 95 public void setCustomizerValue() { 96 FontCustomEditorOperator customizer = new FontCustomEditorOperator(propertyCustomizer); 97 98 int index1,index2,index3; 99 index1 = propertyValue_L.indexOf(", "); 100 101 if(index1>0){ 102 customizer.setFontName(propertyValue_L.substring(0,index1).trim()); 103 index2 = propertyValue_L.indexOf(", ", index1+1); 104 105 if(index2>0){ 106 customizer.setFontSize(propertyValue_L.substring(index1+1,index2).trim()); 107 customizer.setFontStyle(propertyValue_L.substring(index2+1).trim()); 108 } 109 } 110 111 } 112 113 public void verifyPropertyValue(boolean expectation) { 114 verifyExpectationValue(propertyName_L,expectation, propertyValueExpectation_L, propertyValue_L, waitDialog); 115 } 116 117 public String getValue(String propertyName) { 118 String returnValue; 119 PropertySheetOperator propertiesTab = new PropertySheetOperator(propertiesWindow); 120 121 returnValue = new FontProperty(propertiesTab, propertyName_L).getValue(); 122 err.println("GET VALUE = [" + returnValue + "]."); 123 124 128 return returnValue; 129 } 130 131 public void verifyCustomizerLayout() { 132 FontCustomEditorOperator customizer = new FontCustomEditorOperator(propertyCustomizer); 133 customizer.verify(); 134 customizer.btOK(); 135 customizer.btCancel(); 136 } 137 138 141 public static void main(String [] args) { 142 junit.textui.TestRunner.run(suite()); 144 } 145 146 } 147 | Popular Tags |