Ejemplo n.º 1
0
        public virtual void testGetSignatureVector_Old()
        {
            testBuildOldLayout();
            JDFLayout    lo  = (JDFLayout)n.getMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null, 0);
            VElement     v   = lo.getSignatureVector();
            JDFSignature sig = (JDFSignature)v[0];

            Assert.AreEqual(sig.getName(), sig.getSignatureName());
            Assert.AreEqual("Sig1", sig.getSignatureName());
            JDFSignature sig2 = (JDFSignature)v[1];

            Assert.AreEqual(sig2.getName(), sig2.getSignatureName());
            Assert.AreEqual("Sig2", sig2.getSignatureName());
            VElement vSheet = sig2.getSheetVector();
            JDFSheet s1     = (JDFSheet)vSheet[1]; // don't try 0 it will

            // fail because it is
            // referenced...
            Assert.AreEqual("Sig2", s1.getSignatureName());
            Assert.AreEqual("Sheet2_2", s1.getSheetName());
            JDFSurface su = s1.getCreateBackSurface();

            Assert.AreEqual("Sig2", su.getSignatureName());
            Assert.AreEqual("Sheet2_2", su.getSheetName());
            Assert.AreEqual(su, s1.getSurfaceVector()[0]);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
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);
        }