1 19 package org.netbeans.jellytools.modules.xml.actions; 20 21 import junit.textui.TestRunner; 22 import org.netbeans.jellytools.NbDialogOperator; 23 import org.netbeans.jellytools.actions.Action; 24 import org.netbeans.jellytools.modules.css.actions.CheckCSSAction; 25 import org.netbeans.jellytools.modules.css.actions.CopyHTMLStyleAction; 26 import org.netbeans.jellytools.modules.css.actions.CopyXMLStyleAction; 27 import org.netbeans.jellytools.modules.xml.catalog.nodes.XMLEntityCatalogsNode; 28 import org.netbeans.jellytools.nodes.Node; 29 import org.netbeans.jemmy.EventDispatcher; 30 import org.netbeans.tests.xml.JXTest; 31 32 33 34 public class ActionsTest extends JXTest { 35 private static final int CLASS = 0; 36 private static final int TPATH = 1; 37 private static final int ATTRS = 2; 38 39 40 public ActionsTest(String testName) { 41 super(testName); 42 } 43 44 46 public void test() { 47 69 73 75 78 } 81 82 84 85 private boolean catalogActionTest(Action action, String attrs, String treePath) { 86 return actionTest(action, attrs, XMLEntityCatalogsNode.getInstance().getCatalog(treePath)); 87 } 88 89 90 private boolean documentActionTest(Action action, String attrs, String treePath) { 91 return actionTest(action, attrs, findDataNode(treePath)); 92 } 93 94 104 private boolean actionTest(Action action, String attrs, Node node) { 105 boolean pass = true; 106 log("<test class=\"" + action.getClass().getName() + "\">"); 107 try { 108 boolean close = (attrs.indexOf('c') != -1); 109 110 if (attrs.indexOf('P') != -1) { 117 log(" <popup-test-start\\>"); 118 action.performPopup(node); 119 if (close) cancelDialog(); 120 else sleepTest(1000); 121 log(" <popup-test-finished\\>"); 122 } 123 if (attrs.indexOf('A') != -1) { 124 log(" <API-test-start\\>"); 125 action.performAPI(node); 126 if (close) cancelDialog(); 127 else sleepTest(1000); 128 log(" <API-test-finished\\>"); 129 } 130 } catch (Exception ex) { 131 pass = false; 132 log("Failed:", ex); 133 } finally { 134 log("<\\test>"); 135 } 136 return pass; 137 } 138 139 140 private void cancelDialog() { 141 try { 142 EventDispatcher.waitQueueEmpty(); 143 } catch (Exception e) { } 144 sleepTest(1000); 145 146 new NbDialogOperator("").cancel(); 147 } 148 149 151 public static void main(String [] args) throws Exception { 152 System.setProperty("xmltest.dbgTimeouts", "true"); 153 logIntoConsole(true); 154 TestRunner.run(ActionsTest.class); 155 } 156 } 157 | Popular Tags |