Esempio n. 1
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. 2
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. 3
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. 4
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. 5
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());
        }
Esempio n. 6
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. 7
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. 8
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. 9
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. 10
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. 11
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);
        }