public virtual void ResolveCountersTest() { CssCounterManager manager = new CssCounterManager(); manager.ResetCounter("counter1", 1); NUnit.Framework.Assert.AreEqual("1", manager.ResolveCounters("counter1", ";", CounterDigitsGlyphStyle.DEFAULT )); NUnit.Framework.Assert.AreEqual("0", manager.ResolveCounters("counter2", "::", CounterDigitsGlyphStyle.DEFAULT )); IElementNode node1 = new CssPseudoElementNode(null, "name"); manager.PushEveryCounterToCounters(node1); manager.ResetCounter("counter2", 1); manager.IncrementCounter("counter1", 2); NUnit.Framework.Assert.AreEqual("3", manager.ResolveCounters("counter1", ";", CounterDigitsGlyphStyle.DEFAULT )); NUnit.Framework.Assert.AreEqual("1", manager.ResolveCounters("counter2", "::", CounterDigitsGlyphStyle.DEFAULT )); IElementNode node2 = new CssPseudoElementNode(null, "name"); manager.PushEveryCounterToCounters(node2); manager.ResetCounter("counter1", 2); manager.ResetCounter("counter1", 30); manager.ResetCounter("counter2", 10); NUnit.Framework.Assert.AreEqual("3;30", manager.ResolveCounters("counter1", ";", CounterDigitsGlyphStyle.DEFAULT )); NUnit.Framework.Assert.AreEqual("1::10", manager.ResolveCounters("counter2", "::", CounterDigitsGlyphStyle .DEFAULT)); }
public virtual void PushPopEveryCounterToCountersTest() { CssCounterManager manager = new CssCounterManager(); manager.ResetCounter("counter1", 1); manager.ResetCounter("counter2", 2); NUnit.Framework.Assert.AreEqual("1", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle.DEFAULT )); NUnit.Framework.Assert.AreEqual("2", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT )); IElementNode node1 = new CssPseudoElementNode(null, "name"); manager.PushEveryCounterToCounters(node1); manager.ResetCounter("counter1", 3); manager.ResetCounter("counter2", 4); NUnit.Framework.Assert.AreEqual("1,3", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle.DEFAULT )); NUnit.Framework.Assert.AreEqual("2,4", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT )); IElementNode node2 = new CssPseudoElementNode(null, "name"); manager.PushEveryCounterToCounters(node2); manager.ResetCounter("counter1", 5); NUnit.Framework.Assert.AreEqual("1,3,5", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle. DEFAULT)); NUnit.Framework.Assert.AreEqual("2,4", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT )); IElementNode node3 = new CssPseudoElementNode(null, "name"); manager.PushEveryCounterToCounters(node3); NUnit.Framework.Assert.AreEqual("1,3,5", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle. DEFAULT)); NUnit.Framework.Assert.AreEqual("2,4", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT )); manager.PopEveryCounterFromCounters(node3); NUnit.Framework.Assert.AreEqual("1,3,5", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle. DEFAULT)); NUnit.Framework.Assert.AreEqual("2,4", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT )); manager.PopEveryCounterFromCounters(node2); NUnit.Framework.Assert.AreEqual("1,3", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle.DEFAULT )); NUnit.Framework.Assert.AreEqual("2,4", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT )); manager.PopEveryCounterFromCounters(node1); NUnit.Framework.Assert.AreEqual("1", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle.DEFAULT )); NUnit.Framework.Assert.AreEqual("2", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT )); manager.PopEveryCounterFromCounters(node1); }
public virtual void ResolveTargetCountersTest() { CssCounterManager manager = new CssCounterManager(); manager.ResetCounter("counter"); manager.IncrementCounter("counter", 5); NUnit.Framework.Assert.IsNull(manager.ResolveTargetCounters("id", "counter", ".", CounterDigitsGlyphStyle. DEFAULT)); NUnit.Framework.Assert.IsNull(manager.ResolveTargetCounters("id", "counter", ".", CounterDigitsGlyphStyle. DEFAULT)); IElementNode node = new _CssPseudoElementNode_127(null, "name"); manager.AddTargetCountersIfRequired(node); NUnit.Framework.Assert.AreEqual("5", manager.ResolveTargetCounters("id", "counter", ".", CounterDigitsGlyphStyle .DEFAULT)); NUnit.Framework.Assert.IsNull(manager.ResolveTargetCounters("id", "counter2", ".", CounterDigitsGlyphStyle .DEFAULT)); manager.IncrementCounter("counter2", 10); manager.AddTargetCountersIfRequired(node); NUnit.Framework.Assert.AreEqual("10", manager.ResolveTargetCounters("id", "counter2", ".", CounterDigitsGlyphStyle .DEFAULT)); manager.PushEveryCounterToCounters(node); manager.ResetCounter("counter2", 7); manager.AddTargetCountersIfRequired(node); NUnit.Framework.Assert.AreEqual("5", manager.ResolveTargetCounters("id", "counter", ".", CounterDigitsGlyphStyle .DEFAULT)); NUnit.Framework.Assert.AreEqual("10.7", manager.ResolveTargetCounters("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))); }