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"); }
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"); }