public void testFitsValue_ListType() { theState.setListType(EnumListType.Range); Assert.IsTrue(theState.fitsValue("a", EnumFitsValue.Allowed), "single values a re ranges too"); Assert.IsFalse(theState.fitsValue("a b", EnumFitsValue.Allowed)); theState.setAllowedValueList(null); Assert.IsTrue(theState.fitsValue("a ~ b", EnumFitsValue.Allowed)); Assert.IsFalse(theState.fitsValue("a b", EnumFitsValue.Allowed)); }
public override void setUp() { base.setUp(); JDFDoc doc = new JDFDoc("NameState"); theState = (JDFNameState)doc.getRoot(); theState.setAllowedValueList(new VString("a b c d", null)); }
public virtual void testNameState() { JDFDoc d = new JDFDoc("NameState"); JDFNameState ns = (JDFNameState)d.getRoot(); VString nl = new VString(); nl.Add("anna~berta"); ns.setAllowedValueList(nl); ns.setListType(EnumListType.RangeList); Assert.IsTrue(ns.fitsValue("anna~berta", EnumFitsValue.Allowed)); Assert.IsFalse(ns.fitsValue("hans~otto", EnumFitsValue.Allowed)); nl.Add("anna~berta hans~otto"); ns.setAllowedValueList(nl); Assert.IsTrue(ns.fitsValue("anna~berta", EnumFitsValue.Allowed)); Assert.IsTrue(ns.fitsValue("hans~otto", EnumFitsValue.Allowed)); ns.setAllowedValueList(null); ns.setAllowedRegExp("*"); Assert.IsTrue(ns.fitsValue("hans~otto", EnumFitsValue.Allowed)); ns.setAllowedRegExp("[ab].*"); Assert.IsTrue(ns.fitsValue("al", EnumFitsValue.Allowed)); Assert.IsFalse(ns.fitsValue("cl", EnumFitsValue.Allowed)); }
public virtual void testUsageCounterDevCaps() { JDFDoc duc = new JDFDoc("DeviceCap"); JDFDeviceCap devicecap = (JDFDeviceCap)duc.getRoot(); JDFDevCaps dcs = devicecap.appendDevCaps(); dcs.setName(ElementName.USAGECOUNTER); JDFDevCap dc = dcs.appendDevCapInPool(); dc.setMinOccurs(3); dc.setMaxOccurs(3); JDFNameState counterID = dc.appendNameState(AttributeName.COUNTERID); counterID.setAllowedValueList(new VString("ID_Black ID_Color ID_Total", null)); counterID.setListType(EnumListType.SingleValue); duc.write2File(sm_dirTestDataTemp + "DevCapUsageCounter.jdf", 2, false); }