public virtual void testNonAsciiFileURL() { for (int i = 0; i < 2; i++) // loop over escape and non-escape { FileInfo f = new FileInfo("4€5%äö.txt"); FileInfo f2 = FileUtil.getFileInDirectory(new DirectoryInfo(sm_dirTestDataTemp), f); f2.Delete(); SupportClass.FileSupport.CreateNewFile(f2); f2.Refresh(); Assert.IsTrue(f2.Exists); string url = UrlUtil.fileToUrl(f2, i == 0); XMLDoc doc = new XMLDoc("URL", null); KElement root = doc.getRoot(); root.setAttribute("url", url); doc.write2File(sm_dirTestDataTemp + "url.xml", 2, false); JDFParser p = new JDFParser(); p.bKElementOnly = true; JDFDoc d = p.parseFile(sm_dirTestDataTemp + "url.xml"); KElement root2 = d.getRoot(); string urlParse = root2.getAttribute("url"); Assert.AreEqual(url, urlParse); FileInfo f3 = UrlUtil.urlToFile(urlParse); Assert.AreEqual(f2.FullName, f3.FullName); Assert.IsTrue(f3.Exists); } }
public virtual void testGetExecutableJDF() { string docTest = "MISPrepress_ICS_Minimal.jdf"; string docDevCap = "DevCaps_Product_MISPrepress_ICS_Minimal.jdf"; // parse input file JDFParser p = new JDFParser(); JDFDoc jmfDevCap = p.parseFile(sm_dirTestData + docDevCap); JDFJMF jmfRoot = null; Assert.IsNotNull(jmfDevCap, "Parse of file " + docDevCap + " failed"); jmfRoot = jmfDevCap.getJMFRoot(); Assert.IsNotNull(jmfRoot, "jmfRoot == null Can't start Test"); XMLDoc docOutDevCap = jmfRoot.getOwnerDocument_KElement(); docOutDevCap.write2File(sm_dirTestDataTemp + "_" + docDevCap, 0, true); JDFDoc jdfTest = p.parseFile(sm_dirTestData + docTest); JDFNode jdfRoot = jdfTest.getJDFRoot(); Assert.IsTrue(jdfRoot != null, "jdfRoot is null"); if (jdfRoot != null) { jdfRoot.getOwnerDocument_KElement(); JDFDeviceCap deviceCap = (JDFDeviceCap)jmfRoot.getChildByTagName("DeviceCap", null, 0, null, false, true); EnumFitsValue testlists = EnumFitsValue.Allowed; EnumValidationLevel level = KElement.EnumValidationLevel.Complete; VElement vExecNodes = deviceCap.getExecutableJDF(jdfRoot, testlists, level); if (vExecNodes == null) { Console.WriteLine(docDevCap + ": found No matching JDFNode"); } else { for (int n = 0; n < vExecNodes.Count; n++) { // XMLDoc docExecNodes = ((JDFNode) // vExecNodes.elementAt(n)).getOwnerDocument_KElement(); // docExecNodes.write2File ("temp\\" + "_" + docTest // +"_ExecNode" + (n+1) + // ".jdf", 0); Console.WriteLine(vExecNodes[n]); } } XMLDoc testResult = deviceCap.getBadJDFInfo(jdfRoot, testlists, level); if (testResult != null) { testResult.write2File(sm_dirTestDataTemp + "_BugReport.xml", 0, true); } } }