Exemple #1
0
        public virtual void testFormat()
        {
            JDFDoc     doc  = new JDFDoc(ElementName.JDF);
            JDFNode    root = doc.getJDFRoot();
            JDFComment c11  = root.appendComment();
            string     txt  = "This element should have no ID attribute and is a rellly long line with many many characters.. asfihAFLKFKJGFaufksgUFGagfAFKJSG";

            txt += txt;
            txt += txt; // even longer...
            c11.setText(txt);
            JDFComment   c21  = root.appendComment();
            const string txt2 = "This element \n has \n crlf";

            c21.setText(txt2);
            Assert.AreEqual(txt, c11.getText(), "text is equal in DOM");
            Assert.AreEqual(txt2, c21.getText(), "text is equal in DOM");
            string commentFile = sm_dirTestDataTemp + @"\CommentTest.JDF";

            doc.write2File(commentFile, 2, true);
            JDFParser  p     = new JDFParser();
            JDFDoc     doc2  = p.parseFile(commentFile);
            JDFNode    root2 = doc2.getJDFRoot();
            JDFComment c12   = root2.getComment(0);
            JDFComment c22   = root2.getComment(1);

            Assert.AreEqual(txt, c12.getText(), "text is equal after parse");
            Assert.AreEqual(txt2, c22.getText(), "text is equal after parse");
        }
Exemple #2
0
        public virtual void testEraseEmptyNodes()
        {
            JDFDoc     doc  = new JDFDoc(ElementName.JDF);
            JDFNode    root = doc.getJDFRoot();
            JDFComment c11  = root.appendComment();
            string     txt  = "      \n\n";

            c11.setText(txt);
            root.eraseEmptyNodes(true);
            Assert.AreEqual(txt, c11.getText(), "whitespace is not removed");
        }
Exemple #3
0
        public virtual void testInit()
        {
            JDFDoc     doc   = new JDFDoc(ElementName.JDF);
            JDFNode    root  = doc.getJDFRoot();
            JDFComment cRoot = root.appendComment();

            Assert.IsNotNull(cRoot.getAttribute(AttributeName.ID, null, null));
            Assert.IsTrue(cRoot.isValid(EnumValidationLevel.Complete));

            root.setVersion(JDFElement.EnumVersion.Version_1_2);
            JDFAuditPool    ap    = root.getCreateAuditPool();
            JDFNotification notif = ap.addNotification(JDFNotification.EnumClass.Information, "Me", null);
            JDFComment      c     = notif.appendComment();

            c.setText("This element should have no ID attribute");
            string id = c.getAttribute(AttributeName.ID, null, null);

            Assert.IsNull(id);
        }