Exemplo n.º 1
0
        public virtual void testIntegerState()
        {
            JDFDoc              d   = new JDFDoc("IntegerState");
            JDFIntegerState     @is = (JDFIntegerState)d.getRoot();
            JDFIntegerRangeList irl = new JDFIntegerRangeList("12~15");

            @is.setAllowedValueList(irl);
            @is.setListType(EnumListType.RangeList);
            Assert.IsTrue(@is.fitsValue("12~15", EnumFitsValue.Allowed));
            Assert.IsFalse(@is.fitsValue("19~33", EnumFitsValue.Allowed));
            irl = new JDFIntegerRangeList("12~15 19~33");
            @is.setAllowedValueList(irl);
            Assert.IsTrue(@is.fitsValue("12~15", EnumFitsValue.Allowed));
            Assert.IsTrue(@is.fitsValue("19~33", EnumFitsValue.Allowed));
        }
Exemplo n.º 2
0
        public void testFitsValue()
        {
            JDFParser p       = new JDFParser();
            string    strNode = "<IntegerState Name=\"BitDepth\" DefaultValue=\"1\" AllowedValueList=\"1 8 12\"/>";

            JDFDoc          jdfDoc = p.parseString(strNode);
            JDFIntegerState state  = (JDFIntegerState)jdfDoc.getRoot();

            JDFIntegerRangeList list = new JDFIntegerRangeList();

            list.Append(new JDFIntegerRange(1, 12)); // 1~12
            // list.append(12);

            state.setListType(EnumListType.RangeList);
            Assert.IsFalse(state.fitsValue(list.ToString(), EnumFitsValue.Allowed), "ListType=RangeList");

            JDFIntegerRangeList list2 = new JDFIntegerRangeList();

            list2.Append(new JDFIntegerRange(1, -2)); // 1~-2

            JDFIntegerRangeList allowedVL = new JDFIntegerRangeList();

            allowedVL.Append(new JDFIntegerRange(1, 32)); // 1~32

            state.setAllowedValueList(allowedVL);         // new AllowedVlaueList

            Assert.IsTrue(state.fitsValue(list2.ToString(), EnumFitsValue.Allowed), "xDef is wrong");

            list.erase(list.Count - 1); // erase "1~12"
            list.Append(2);
            list.Append(12);
            list.Append(22);
            state.setListType(EnumListType.List);
            state.setAllowedValueMod(new JDFXYPair(10, 2));
            Assert.IsTrue(state.fitsValue(list.ToString(), EnumFitsValue.Allowed), "ListType=List, ValueMod=" + state.getAllowedValueMod());
        }