Esempio n. 1
0
        public virtual void testRemoveChild()
        {
            JDFDoc  d = new JDFDoc("JDF");
            JDFNode n = d.getJDFRoot();

            n.setType("ConventionalPrinting", true);
            JDFExposedMedia xmpl = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", EnumProcessUsage.Plate, null);
            JDFExposedMedia xmpr = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", EnumProcessUsage.Proof, null);
            JDFMedia        m    = xmpr.appendMedia();

            Assert.IsNotNull(xmpr.getMedia());
            m.setID("id1");
            KElement t1 = n.getTarget("id1", "ID");

            m = (JDFMedia)m.makeRootResource(null, null, true);
            Assert.AreEqual(m, t1);
            Assert.IsNotNull(xmpr.getMedia());
            xmpl.refElement(m);
            Assert.IsNotNull(xmpl.getMedia());
            JDFResourcePool rp = n.getResourcePool();

            Assert.IsNotNull(rp.getElement("Media"));
            xmpl.removeChild("Media", null, 0);
            Assert.IsNull(xmpl.getMedia());
            Assert.IsNotNull(rp.getElement("Media"));
            xmpr.removeChildren("Media", null, null);
            Assert.IsNull(xmpr.getMedia());
            Assert.IsNotNull(rp.getElement("Media"));
        }
Esempio n. 2
0
        public void testMarkObject()
        {
            JDFDoc  doc  = new JDFDoc("JDF");
            JDFNode root = doc.getJDFRoot();

            root.setVersion(EnumVersion.Version_1_4);
            root.setType(EnumType.Tiling);
            JDFResourcePool resPool = root.getCreateResourcePool();
            KElement        kElem   = resPool.appendResource(ElementName.TILE, null, null);

            Assert.IsTrue(kElem is JDFTile);
            JDFTile tile = ((JDFTile)kElem);

            try
            {
                tile.setClipBox(new JDFRectangle("0 0 123 123"));
                tile.setCTM(new JDFMatrix("1 0 0 1 0 0"));
                JDFMarkObject m = tile.appendMarkObject();
                m.setOrd(0);
                m.setCTM(new JDFMatrix("1.2 0 0 1.4 1 444."));
                Assert.IsTrue(m.isValid(EnumValidationLevel.Complete));
                JDFMarkObject m2 = tile.appendMarkObject();
                m2.setOrd(0);
                m2.setCTM(new JDFMatrix("1.234 0 0 1.4 1 444."));
                Assert.IsTrue(m2.isValid(EnumValidationLevel.Complete));
                Assert.AreEqual(tile.getMarkObject(1), m2);
                Assert.AreEqual(tile.getCreateMarkObject(1), m2);
                Assert.IsTrue(tile.isValid(EnumValidationLevel.Complete));
            }
            catch (FormatException)
            {
                Assert.Fail("bad unit matrix");
            }
        }
Esempio n. 3
0
        public void testSeparationList()
        {
            JDFDoc          doc     = new JDFDoc("JDF");
            JDFNode         root    = doc.getJDFRoot();
            JDFResourcePool resPool = root.getCreateResourcePool();
            KElement        kElem   = resPool.appendResource(ElementName.COLORANTCONTROL, null, null);

            Assert.IsTrue(kElem is JDFColorantControl);
            JDFColorantControl cc   = ((JDFColorantControl)kElem);
            JDFSeparationList  co   = cc.appendColorantOrder();
            VString            seps = new VString(StringUtil.tokenize("Cyan Magenta Yellow Black", " ", false));

            co.setSeparations(seps);
            CollectionAssert.AreEqual(co.getSeparations(), seps);
            VElement vSepSpec = co.getChildElementVector(ElementName.SEPARATIONSPEC, null, null, true, 0, true);

            Assert.AreEqual(seps.Count, vSepSpec.Count);
            for (int i = 0; i < vSepSpec.Count; i++)
            {
                Assert.IsFalse(vSepSpec.item(i).hasAttribute(AttributeName.CLASS));
                Assert.IsFalse(vSepSpec.item(i) is JDFResource);
            }

            Assert.AreEqual("Cyan", co.getSeparation(0));
            co.removeSeparation("Magenta");
            Assert.AreEqual("Cyan", co.getSeparation(0));
            Assert.AreEqual("Yellow", co.getSeparation(1));
            Assert.AreEqual("Black", co.getSeparation(2));
            Assert.IsNull(co.getSeparation(3));
        }
Esempio n. 4
0
        public void testSetGetDimension()
        {
            JDFDoc          doc     = new JDFDoc("JDF");
            JDFNode         root    = doc.getJDFRoot();
            JDFResourcePool resPool = root.getCreateResourcePool();
            KElement        kElem   = resPool.appendResource(ElementName.MEDIA, EnumResourceClass.Consumable, null);

            Assert.IsTrue(kElem is JDFMedia);
            JDFMedia media = ((JDFMedia)kElem);

            media.setDimensionCM(new JDFXYPair(2.54, 2.54));

            JDFXYPair result = media.getDimension();

            Assert.AreEqual(new JDFXYPair(72, 72), result);

            result = media.getDimensionCM();
            Assert.AreEqual(new JDFXYPair(2.54, 2.54), result);

            result = media.getDimensionInch();
            Assert.AreEqual(new JDFXYPair(1, 1), result);

            media.setDimensionInch(new JDFXYPair(1, 1));

            result = media.getDimension();
            Assert.AreEqual(new JDFXYPair(72, 72), result);

            result = media.getDimensionCM();
            Assert.AreEqual(new JDFXYPair(2.54, 2.54), result);

            result = media.getDimensionInch();
            Assert.AreEqual(new JDFXYPair(1, 1), result);
        }
Esempio n. 5
0
        public virtual void testRRefs()
        {
            JDFResourcePool rp = n.appendResourcePool();

            rp.setAttribute(AttributeName.RREFS, "a b", null);
            n.fixVersion(null);
            Assert.IsFalse(rp.hasAttribute(AttributeName.RREFS));
        }
Esempio n. 6
0
        public void testGetMimeType()
        {
            JDFResourcePool resPool = root.getCreateResourcePool();
            KElement        kElem   = resPool.appendResource(ElementName.RUNLIST, null, null);

            Assert.IsTrue(kElem is JDFRunList);
            JDFRunList ruli = (JDFRunList)kElem;

            Assert.IsNull(ruli.getFileMimeType());
            kElem.setXPathAttribute("LayoutElement/FileSpec/@MimeType", "application/pdf");
            Assert.AreEqual("application/pdf", ruli.getFileMimeType());
        }
Esempio n. 7
0
        public void testExtendedAddress()
        {
            JDFDoc          doc     = new JDFDoc("JDF");
            JDFNode         root    = doc.getJDFRoot();
            JDFResourcePool resPool = root.getCreateResourcePool();
            KElement        kElem   = resPool.appendResource(ElementName.ADDRESS, null, null);

            Assert.IsTrue(kElem is JDFAddress);
            JDFAddress ad = (JDFAddress)kElem;
            JDFComment c  = (JDFComment)ad.appendExtendedAddress();

            Assert.IsFalse(c.hasAttribute(AttributeName.ID));
        }
Esempio n. 8
0
        public override void setUp()
        {
            base.setUp();
            JDFElement.setLongID(false);
            d    = new JDFDoc(ElementName.JDF);
            elem = d.getJDFRoot();
            JDFResourcePool rpool = elem.appendResourcePool();

            colControl = (JDFColorantControl)rpool.appendResource(ElementName.COLORANTCONTROL, EnumResourceClass.Parameter, null);
            colControl.setProcessColorModel("DeviceCMYK");
            colControl.setResStatus(EnumResStatus.Available, true);
            colParams = colControl.appendColorantParams();
            colPool   = colControl.appendColorPool();
            colPool.makeRootResource(null, null, true);
        }
Esempio n. 9
0
        public void testGetSeparations()
        {
            JDFDoc          doc     = new JDFDoc("JDF");
            JDFNode         root    = doc.getJDFRoot();
            JDFResourcePool resPool = root.getCreateResourcePool();
            KElement        kElem   = resPool.appendResource(ElementName.COLORANTCONTROL, null, null);

            Assert.IsTrue(kElem is JDFColorantControl);
            JDFColorantControl cc = ((JDFColorantControl)kElem);

            cc.setProcessColorModel("DeviceCMYK");
            Assert.IsTrue(cc.getSeparations().Contains("Cyan"));
            cc.appendColorantParams().appendSeparation("Snarf Blue");
            Assert.IsTrue(cc.getSeparations().Contains("Snarf Blue"));
        }
Esempio n. 10
0
        public void testGetTruePage()
        {
            JDFResourcePool resPool = root.getCreateResourcePool();
            JDFRunList      ruli    = (JDFRunList)resPool.appendResource(ElementName.RUNLIST, null, null);

            Assert.AreEqual(ruli, ruli.getTruePage());
            JDFRunList ruli2 = ruli.addSepRun(StringUtil.tokenize("c.pdf m.pdf y.pdf k.pdf", " ", false), StringUtil.tokenize("Cyan Magenta Yellow Black", " ", false), 0, 4, true);

            Assert.AreEqual(ruli, ruli.getTruePage());
            Assert.AreEqual(ruli2, ruli2.getTruePage());
            JDFRunList ruli2c = (JDFRunList)ruli2.getElement_KElement(ElementName.RUNLIST, null, 0);

            Assert.AreEqual(ruli2, ruli2.getTruePage());
            Assert.AreEqual(ruli2, ruli2c.getTruePage());
        }
Esempio n. 11
0
        public void testBlockName()
        {
            JDFDoc          doc     = new JDFDoc("JDF");
            JDFNode         root    = doc.getJDFRoot();
            JDFResourcePool resPool = root.getCreateResourcePool();
            KElement        kElem   = resPool.appendResource(ElementName.CUTBLOCK, null, null);

            Assert.IsTrue(kElem is JDFCutBlock);
            JDFCutBlock block = (JDFCutBlock)kElem;

            block.setBlockName("Foo");
            block.setBlockSize(new JDFXYPair(10, 10));
            block.setBlockType(EnumBlockType.CutBlock);
            Assert.IsTrue(block.isValid(EnumValidationLevel.Complete));
        }
Esempio n. 12
0
        public virtual void testWebGrowthCompensation()
        {
            JDFElement.setLongID(false);
            doc = new JDFDoc("JDF");
            JDFNode         n    = doc.getJDFRoot();
            JDFResourcePool rp   = n.getCreateResourcePool();
            JDFResource     lo   = n.addResource("Layout", EnumResourceClass.Parameter, EnumUsage.Input, null, null, null, null);
            JDFLayout       losh = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Sheet1");
            JDFLayout       lofr = (JDFLayout)losh.addPartition(EnumPartIDKey.Side, EnumSide.Front.getName());

            rp.appendXMLComment("LayoutShift SHOULD be partitioned: at least Side and Separation will make sense", null);

            JDFResource los = n.addResource("LayoutShift", EnumResourceClass.Parameter, EnumUsage.Input, null, null, null, null);

            los.appendXMLComment("Note that the interpolation algorithm between positions is implementation dependent", null);
            los = los.addPartition(EnumPartIDKey.Side, "Front");
            VString vSep = new VString("Cyan Magenta Yellow Black", " ");

            for (int i = 0; i < 16; i++)
            {
                int x               = 720 * (i % 4);
                int y               = 1000 * (i / 4);
                int ord             = i % 8;
                JDFContentObject co = lofr.appendContentObject();
                co.setOrd(ord);
                co.setOrdID(i);
                co.setCTM(new JDFMatrix(1, 0, 0, 1, x, y));
                JDFMarkObject mo = lofr.appendMarkObject();
                mo.setOrd(ord);
                mo.setOrdID(i + 100);
                mo.setCTM(new JDFMatrix(1, 0, 0, 1, x + 700, y + 900));
            }
            for (int j = 0; j < vSep.Count; j++)
            {
                KElement sepShift = los.addPartition(EnumPartIDKey.Separation, vSep.stringAt(j));
                for (int i = 0; i < 16; i += 2)
                {
                    int      x           = 720 * (i % 4);
                    int      y           = 1000 * (i / 4);
                    KElement shiftObject = sepShift.appendElement("ShiftPoint");

                    shiftObject.setAttribute("Position", new JDFXYPair(x + 360, y + 500).ToString());
                    shiftObject.setAttribute("CTM", new JDFMatrix(1, 0, 0, 1, j + i / 4, j + i % 4).ToString());
                }
            }
            doc.write2File(sm_dirTestDataTemp + "WebgrowthPartition.jdf", 2, false);
        }
Esempio n. 13
0
        public void testStitchType()
        {
            JDFDoc          doc     = new JDFDoc("JDF");
            JDFNode         root    = doc.getJDFRoot();
            JDFResourcePool resPool = root.getCreateResourcePool();
            KElement        kElem   = resPool.appendResource(ElementName.STITCHINGPARAMS, null, null);

            Assert.IsTrue(kElem is JDFStitchingParams);
            JDFStitchingParams sp = (JDFStitchingParams)kElem;

            sp.setStitchType(EnumStitchType.Saddle);
            string write2String = doc.write2String(0);

            Assert.IsTrue(write2String.IndexOf("StitchType=\"Saddle\"") > 22);
            JDFParser p2 = new JDFParser();
            JDFDoc    d2 = p2.parseString(write2String);

            Assert.IsTrue(d2.write2String(0).IndexOf("StitchType=\"Saddle\"") > 22);
        }
Esempio n. 14
0
        public void testHoleType()
        {
            JDFDoc          doc     = new JDFDoc("JDF");
            JDFNode         root    = doc.getJDFRoot();
            JDFResourcePool resPool = root.getCreateResourcePool();

            // check HoleType for JDFMedia
            KElement kElem = resPool.appendResource(ElementName.MEDIA,
                                                    EnumResourceClass.Consumable, null);

            Assert.IsTrue(kElem is JDFMedia);
            JDFMedia media = ((JDFMedia)kElem);

            List <ValuedEnum> v = new List <ValuedEnum>();

            v.Add(EnumHoleType.None);
            v.Add(EnumHoleType.C9_5m_round_0t);
            Assert.AreEqual("C9.5m-round-0t", EnumHoleType.C9_5m_round_0t.getName());

            media.setHoleType(v);
            CollectionAssert.AreEqual(media.getHoleType(), v);
            Assert.AreEqual(v[1].getName(), ((EnumHoleType)media.getHoleType()[1]).getName());
            Assert.AreEqual("C9.5m-round-0t", ((EnumHoleType)media.getHoleType()[1]).getName());

            // overwrite HoleType low level to check if conversion of DOT and HYPHEN
            // to UNDERSCORE was successful
            media.setAttribute(AttributeName.HOLETYPE, "C9.5m-round-0t");
            Assert.AreEqual(EnumHoleType.C9_5m_round_0t, (media.getHoleType()[0]));

            // now check the same with JDFHoleMakingParams
            kElem = resPool.appendResource(ElementName.HOLEMAKINGPARAMS,
                                           EnumResourceClass.Consumable, null);
            Assert.IsTrue(kElem is JDFHoleMakingParams);
            JDFHoleMakingParams holeMakingParams = ((JDFHoleMakingParams)kElem);

            holeMakingParams.setHoleType(v);
            CollectionAssert.AreEqual(holeMakingParams.getHoleType(), v);
            Assert.AreEqual(v[1].getName(), ((EnumHoleType)holeMakingParams.getHoleType()[1]).getName());
            Assert.AreEqual("C9.5m-round-0t", ((EnumHoleType)holeMakingParams.getHoleType()[1]).getName());
        }