Пример #1
0
        public virtual void testEnumerationEvaluation()
        {
            JDFDoc d = new JDFDoc(ElementName.ENUMERATIONEVALUATION);
            JDFEnumerationEvaluation ee = (JDFEnumerationEvaluation)d.getRoot();

            ee.setRegExp("a( b)?");
            Assert.IsTrue(ee.fitsValue("a"));
            Assert.IsTrue(ee.fitsValue("a b"));
            Assert.IsFalse(ee.fitsValue("a b c"));
            Assert.IsFalse(ee.fitsValue("c"));
        }
Пример #2
0
        public virtual void testAction()
        {
            JDFAction act = devicecap.appendActionPool().appendActionTest(EnumTerm.or, false);
            JDFTest   tst = act.getTest();

            tst.setContext("/JDF/ResourcePool/Component");
            JDFor or = (JDFor)((JDFnot)tst.getTerm()).getTerm(EnumTerm.or, 0);
            JDFIsPresentEvaluation ipe = (JDFIsPresentEvaluation)or.appendTerm(EnumTerm.IsPresentEvaluation);

            ipe.setRefTarget(ptState);
            Assert.AreEqual(ptState.getID(), ipe.getrRef());

            JDFEnumerationEvaluation enev = (JDFEnumerationEvaluation)or.appendTerm(EnumTerm.EnumerationEvaluation);

            enev.setRefTarget(compState);
            enev.setRegExp("(.+ )*FinalProduct( .+)*");

            JDFDoc  doc  = new JDFDoc("JDF");
            JDFNode node = doc.getJDFRoot();

            node.setType("fnarf", false);
            JDFComponent comp = (JDFComponent)node.addResource("Component", null, EnumUsage.Input, null, null, null, null);

            XMLDoc   rep     = new XMLDoc("root", null);
            KElement eRep    = rep.getRoot();
            bool     fitsJDF = tst.fitsJDF(comp, eRep);

            Assert.IsTrue(fitsJDF);

            comp.setProductType("foobar");
            fitsJDF = tst.fitsJDF(comp, eRep);
            Assert.IsFalse(fitsJDF, "have pt");

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

            v.Add(EnumComponentType.FinalProduct);
            comp.setComponentType(v);
            fitsJDF = tst.fitsJDF(comp, eRep);
            Assert.IsFalse(fitsJDF, "have both");

            comp.removeAttribute("ProductType");
            fitsJDF = tst.fitsJDF(comp, eRep);
            Assert.IsFalse(fitsJDF, "have final");

            v = new List <ValuedEnum>();
            v.Add(EnumComponentType.PartialProduct);
            comp.setComponentType(v);
            fitsJDF = tst.fitsJDF(comp, eRep);
            Assert.IsTrue(fitsJDF, "have no final");
        }
Пример #3
0
        protected internal virtual void appendTrimBoxAction()
        {
            {
                JDFAction a = aPool.appendActionSetTest(EnumTerm.RectangleEvaluation, EnumTerm.EnumerationEvaluation, false);
                a.setSeverity(EnumSeverity.Error);
                JDFRectangleEvaluation trimBox = (JDFRectangleEvaluation)((JDFnot)a.getTestTerm()).getTerm(null, 0);
                trimBox.appendBasicPreflightTest("PageBoxSize");
                trimBox.setValueList(new JDFRectangle(0, 0, 8.5 * 72, 11 * 72));
                JDFEnumerationEvaluation setEval = (JDFEnumerationEvaluation)a.getPreflightActionSetTerm();
                setEval.appendBasicPreflightTest("PageBoxName");
                setEval.setValueList(new VString(EnumBox.TrimBox.getName(), " "));

                a.setDescriptiveName("set TrimBox to 8.5*11 Method 2");
            }
        }