Exemple #1
0
        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);
                }
            }
        }
Exemple #2
0
 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);
     }
 }
Exemple #3
0
        public virtual void testFixVersionProblem()
        {
            JDFParser p = new JDFParser();
            JDFDoc    d = p.parseFile(sm_dirTestData + "FixVersionProblem.jdf");

            Assert.IsNotNull(d, "FixVersionProblem exists");
            n = d.getJDFRoot();
            n.fixVersion(EnumVersion.Version_1_2);
            JDFLayout lo = (JDFLayout)n.getResourcePool().getElement(ElementName.LAYOUT, null, 0);

            Assert.AreEqual(1, lo.numChildElements("Signature", null));
        }
Exemple #4
0
        public override void setUp()
        {
            base.setUp();

            JDFParser p      = new JDFParser();
            JDFDoc    jdfDoc = p.parseFile(sm_dirTestData + PACKAGEDATA);

            JDFNode          root    = (JDFNode)jdfDoc.getRoot();
            JDFContentObject contObj = (JDFContentObject)root.getChildByTagName("ContentObject", "", 0, null, false, true);

            m_strPath = contObj.getSourceClipPath();
        }
Exemple #5
0
        public virtual void testDeviceCapIsValid()
        {
            JDFParser p         = new JDFParser();
            string    docDevCap = "DevCaps_Product_MISPrepress_ICS_Minimal.jdf";
            JDFDoc    jmfDevCap = p.parseFile(sm_dirTestData + docDevCap);

            Assert.IsNotNull(jmfDevCap, "Parse of file " + docDevCap + " failed");
            JDFJMF jmfRoot = jmfDevCap.getJMFRoot();

            Assert.IsNotNull(jmfRoot, "jmfRoot == null Can't start Test");
            JDFDeviceCap deviceCap = (JDFDeviceCap)jmfRoot.getChildByTagName("DeviceCap", "", 0, null, false, true);

            Assert.IsTrue(deviceCap.isValid(KElement.EnumValidationLevel.Incomplete));
        }
Exemple #6
0
        public virtual void testDefaultNamespace()
        {
            JDFDoc jdfDoc = new JDFDoc(ElementName.JDF);

            string defaultFile = "default.jdf";

            jdfDoc.write2File(sm_dirTestDataTemp + defaultFile, 0, true);

            JDFParser p            = new JDFParser();
            JDFDoc    jdfDocResult = p.parseFile(sm_dirTestDataTemp + defaultFile);

            jdfDocResult.getRoot();

            // assertXMLEqual (jdfDocResult.getMemberDocument (),
            // jdfDoc.getMemberDocument ());
            Assert.AreEqual(jdfDocResult.getDocumentElement().NamespaceURI, jdfDoc.getDocumentElement().NamespaceURI);
        }