Exemple #1
0
        public virtual void testAmountCondition()
        {
            JDFDoc  d = new JDFDoc(ElementName.JDF);
            JDFNode n = d.getJDFRoot();

            n.setVersion(JDFElement.EnumVersion.Version_1_3);
            n.setType("ConventionalPrinting", true);
            JDFMedia        m    = (JDFMedia)n.addResource(ElementName.MEDIA, null, EnumUsage.Input, null, null, null, null);
            JDFResourceLink rl   = n.getLink(m, null);
            JDFAttributeMap map  = new JDFAttributeMap("SheetName", "s1");
            JDFAttributeMap mapC = new JDFAttributeMap(map);

            mapC.put("Condition", "Good");

            m.setAmount(42);
            Assert.AreEqual("42", m.getAttribute(AttributeName.AMOUNT), "m amount!=42");
            Assert.AreEqual(42.0, rl.getAmount(null), 0.1, "rl amount!=42");
            Assert.AreEqual(42.0, rl.getMinAmount(null), 0.1, "rl amount!=42");
            Assert.AreEqual(42.0, rl.getMaxAmount(null), 0.1, "rl amount!=42");

            rl.setAmount(44, map);
            Assert.AreEqual(44.0, rl.getAmount(map), 0.1, "rl amount!=42");
            Assert.AreEqual(44.0, rl.getMinAmount(map), 0.1, "rl amount!=42");
            Assert.AreEqual(44.0, rl.getMaxAmount(map), 0.1, "rl amount!=42");

            Assert.AreEqual(-1.0, rl.getAmount(mapC), 0.1, "no good in map");
            Assert.AreEqual(-1.0, rl.getMinAmount(mapC), 0.1, "no good in map");
            Assert.AreEqual(-1.0, rl.getMaxAmount(mapC), 0.1, "no good in map");

            rl.removeChild(ElementName.AMOUNTPOOL, null, 0);
            rl.setAmount(44, mapC);
            Assert.AreEqual(44.0, rl.getAmount(mapC), 0.1, "rl amount!=42");
            Assert.AreEqual(44.0, rl.getMinAmount(mapC), 0.1, "rl amount!=42");
            Assert.AreEqual(44.0, rl.getMaxAmount(mapC), 0.1, "rl amount!=42");

            Assert.AreEqual(44.0, rl.getAmount(map), 0.1, "no good in rl");
            Assert.AreEqual(44.0, rl.getMinAmount(map), 0.1, "no good in rl");
            Assert.AreEqual(44.0, rl.getMaxAmount(map), 0.1, "no good in rl");

            JDFAttributeMap mapW = new JDFAttributeMap(map);

            mapW.put("Condition", "Waste");
            rl.setAmount(4, mapW);
            Assert.AreEqual(48.0, rl.getAmount(map), 0.1, "sum g/w in rl");
            Assert.AreEqual(48.0, rl.getMinAmount(map), 0.1, "sum g/w in rl");
            Assert.AreEqual(48.0, rl.getMaxAmount(map), 0.1, "sum g/w in rl");
        }
Exemple #2
0
        public virtual void testAmount()
        {
            JDFDoc  d = new JDFDoc(ElementName.JDF);
            JDFNode n = d.getJDFRoot();

            n.setVersion(JDFElement.EnumVersion.Version_1_3);
            n.setType("ConventionalPrinting", true);
            JDFMedia        m  = (JDFMedia)n.addResource(ElementName.MEDIA, null, EnumUsage.Input, null, null, null, null);
            JDFResourceLink rl = n.getLink(m, null);

            m.setAmount(42);
            Assert.AreEqual("42", m.getAttribute(AttributeName.AMOUNT), "m amount!=42");
            Assert.IsTrue(rl.getAmount(null) == 42, "rl amount!=42");
            Assert.IsTrue(rl.getMinAmount(null) == 42, "rl amount!=42");
            Assert.IsTrue(rl.getMaxAmount(null) == 42, "rl amount!=42");

            rl.setAmount(44, null);
            Assert.AreEqual("44", rl.getAttribute(AttributeName.AMOUNT), "ml amount!=44");
            Assert.IsTrue(rl.getAmount(null) == 44, "rl amount!=44");
            Assert.IsTrue(rl.getMinAmount(null) == 44, "rl amount!=44");
            Assert.IsTrue(rl.getMaxAmount(null) == 44, "rl amount!=44");
        }