Ejemplo n.º 1
0
        public virtual void testFixToNewLayout()
        {
            testBuildOldLayout();
            n.fixVersion(EnumVersion.Version_1_3);
            JDFLayout lo = (JDFLayout)n.getMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null, 0);

            Assert.IsTrue(JDFLayout.isNewLayout(lo));
            JDFSignature si = lo.getSignature(0);

            Assert.AreEqual("Sig1", si.getSignatureName());
            Assert.IsFalse(si.hasAttribute(AttributeName.CLASS));
        }
Ejemplo n.º 2
0
        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);
        }