public virtual void ResolveTargetCounterTest() { CssCounterManager manager = new CssCounterManager(); manager.ResetCounter("counter"); manager.IncrementCounter("counter", 5); NUnit.Framework.Assert.IsNull(manager.ResolveTargetCounter("id", "counter", CounterDigitsGlyphStyle.DEFAULT )); NUnit.Framework.Assert.IsNull(manager.ResolveTargetCounter("id", "counter", CounterDigitsGlyphStyle.DEFAULT )); IElementNode node = new _CssPseudoElementNode_96(null, "name"); manager.AddTargetCounterIfRequired(node); NUnit.Framework.Assert.AreEqual("5", manager.ResolveTargetCounter("id", "counter", CounterDigitsGlyphStyle .DEFAULT)); NUnit.Framework.Assert.IsNull(manager.ResolveTargetCounter("id", "counter2", CounterDigitsGlyphStyle.DEFAULT )); manager.IncrementCounter("counter2", 10); manager.AddTargetCounterIfRequired(node); NUnit.Framework.Assert.AreEqual("10", manager.ResolveTargetCounter("id", "counter2", CounterDigitsGlyphStyle .DEFAULT)); }
public virtual void ResolveEveryCounterWithNotDefaultSymbolsTest() { CssCounterManager manager = new CssCounterManager(); IElementNode node = new _CssPseudoElementNode_272(null, "name"); manager.ResetCounter("counter", 3); manager.PushEveryCounterToCounters(node); NUnit.Framework.Assert.AreEqual("III", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ROMAN))); manager.ResetCounter("counter", 2); NUnit.Framework.Assert.AreEqual("III.II", manager.ResolveCounters("counter", ".", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ROMAN))); manager.ResolveTargetCounter("id", "counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum(CssConstants. UPPER_ROMAN)); manager.ResolveTargetCounters("id", "counter", ".", HtmlUtils.ConvertStringCounterGlyphStyleToEnum(CssConstants .UPPER_ROMAN)); manager.AddTargetCounterIfRequired(node); manager.AddTargetCountersIfRequired(node); NUnit.Framework.Assert.AreEqual("II", manager.ResolveTargetCounter("id", "counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ROMAN))); NUnit.Framework.Assert.AreEqual("III.II", manager.ResolveTargetCounters("id", "counter", ".", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ROMAN))); }
public virtual void AddTargetCounterIfRequiredTest() { CssCounterManager manager = new CssCounterManager(); NUnit.Framework.Assert.IsNull(manager.ResolveTargetCounter("id1", "counter", CounterDigitsGlyphStyle.DEFAULT )); IElementNode node1 = new _CssPseudoElementNode_161(null, "name"); IElementNode node2 = new _CssPseudoElementNode_170(null, "name"); IElementNode node3 = new CssPseudoElementNode(null, "name"); manager.AddTargetCounterIfRequired(node1); manager.AddTargetCounterIfRequired(node2); manager.AddTargetCounterIfRequired(node3); NUnit.Framework.Assert.AreEqual("0", manager.ResolveTargetCounter("id1", "counter", CounterDigitsGlyphStyle .DEFAULT)); NUnit.Framework.Assert.IsNull(manager.ResolveTargetCounter("id2", "counter", CounterDigitsGlyphStyle.DEFAULT )); manager.ResetCounter("counter"); manager.IncrementCounter("counter"); manager.AddTargetCounterIfRequired(node1); NUnit.Framework.Assert.AreEqual("1", manager.ResolveTargetCounter("id1", "counter", CounterDigitsGlyphStyle .DEFAULT)); }