public virtual void testBuildNewLayout() { reset(); JDFLayout lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null); Assert.IsTrue(JDFLayout.isNewLayout(lo), "lo 1.3"); JDFSignature si = lo.appendSignature(); Assert.AreEqual(ElementName.LAYOUT, si.LocalName, "signature name"); si = lo.appendSignature(); Assert.AreEqual(2, lo.numSignatures(), "num sigs"); Assert.AreEqual(ElementName.LAYOUT, si.LocalName, "signature name"); JDFSheet sh = si.appendSheet(); sh = si.appendSheet(); Assert.AreEqual(2, si.numSheets(), "num sheets"); Assert.AreEqual(ElementName.LAYOUT, sh.LocalName, "sheet name"); sh = si.getCreateSheet(4); Assert.AreEqual(3, si.numSheets(), "num sheets"); Assert.AreEqual(ElementName.LAYOUT, sh.LocalName, "sheet name"); sh = si.getSheet(2); Assert.AreEqual(3, si.numSheets(), "num sheets"); Assert.AreEqual(ElementName.LAYOUT, sh.LocalName, "sheet name"); JDFSurface su = sh.appendFrontSurface(); Assert.AreEqual(1, sh.numSurfaces(), "num surfaces"); Assert.AreEqual(ElementName.LAYOUT, su.LocalName, "sheet name"); Assert.IsTrue(sh.hasFrontSurface(), "hasfrontSurface"); su = sh.appendBackSurface(); Assert.AreEqual(2, sh.numSurfaces(), "num surfaces"); Assert.AreEqual(ElementName.LAYOUT, su.LocalName, "sheet name"); try { sh.appendBackSurface(); Assert.Fail("no two back surfaces"); } catch (JDFException) { // nop } si = lo.getCreateSignature(4); Assert.AreEqual(3, lo.numSignatures(), "num sigs"); Assert.AreEqual(ElementName.LAYOUT, si.LocalName, "signature name"); si = lo.getSignature(2); Assert.AreEqual(3, lo.numSignatures(), "num sigs"); Assert.AreEqual(ElementName.LAYOUT, si.LocalName, "signature name"); si = lo.getSignature(5); Assert.IsNull(si, "si null"); Assert.IsTrue(lo.isValid(EnumValidationLevel.Complete), "layout valid"); Assert.AreEqual(lo.numSignatures(), lo.getSignatureVector().Count); }
public virtual void testBuildOldLayout() { reset(); n.setVersion(EnumVersion.Version_1_2); JDFLayout lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null); Assert.IsFalse(JDFLayout.isNewLayout(lo), "lo 1.3"); JDFSignature si = lo.appendSignature(); si.setName("Sig1"); Assert.AreEqual(ElementName.SIGNATURE, si.LocalName, "signature name"); Assert.IsFalse(si.hasAttribute(AttributeName.CLASS)); si = lo.appendSignature(); si.setName("Sig2"); Assert.AreEqual(2, lo.numSignatures(), "num sigs"); Assert.AreEqual(ElementName.SIGNATURE, si.LocalName, "signature name"); JDFSheet sh = si.appendSheet(); sh.setName("Sheet2_1"); sh.makeRootResource(null, null, true); // see what happens with // refelements sh = si.appendSheet(); sh.setName("Sheet2_2"); Assert.AreEqual(2, si.numSheets(), "num sheets"); Assert.AreEqual(ElementName.SHEET, sh.LocalName, "sheet name"); sh = si.getCreateSheet(4); Assert.AreEqual(3, si.numSheets(), "num sheets"); Assert.AreEqual(ElementName.SHEET, sh.LocalName, "sheet name"); sh = si.getSheet(2); Assert.AreEqual(3, si.numSheets(), "num sheets"); Assert.AreEqual(ElementName.SHEET, sh.LocalName, "sheet name"); JDFSurface su = sh.appendFrontSurface(); Assert.AreEqual(1, sh.numSurfaces(), "num surfaces"); Assert.AreEqual(ElementName.SURFACE, su.LocalName, "sheet name"); Assert.IsTrue(sh.hasFrontSurface(), "hasfrontSurface"); su.appendContentObject(); su.appendMarkObject(); su.appendContentObject(); su.appendContentObject(); su = sh.appendBackSurface(); su.makeRootResource(null, null, true); su.appendContentObject(); su.appendMarkObject(); su.appendContentObject(); su.appendContentObject(); su.appendMarkObject(); Assert.AreEqual(2, sh.numSurfaces(), "num surfaces"); Assert.AreEqual(ElementName.SURFACE, su.LocalName, "sheet name"); Assert.IsTrue(sh.hasBackSurface(), "hasBackSurface"); try { sh.appendBackSurface(); Assert.Fail("append second surface"); } catch (JDFException) { // nop } si = lo.getCreateSignature(4); Assert.AreEqual(3, lo.numSignatures(), "num sigs"); Assert.AreEqual(ElementName.SIGNATURE, si.LocalName, "signature name"); si = lo.getSignature(2); Assert.AreEqual(3, lo.numSignatures(), "num sigs"); Assert.AreEqual(ElementName.SIGNATURE, si.LocalName, "signature name"); si = lo.getSignature(5); Assert.IsNull(si, "si null"); Assert.AreEqual(lo.numSignatures(), lo.getSignatureVector().Count); }