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 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 ResetCounterTest() { CssCounterManager manager = new CssCounterManager(); manager.ResetCounter("counter"); NUnit.Framework.Assert.AreEqual("0", manager.ResolveCounter("counter", CounterDigitsGlyphStyle.DEFAULT)); manager.ResetCounter("counter", 101); NUnit.Framework.Assert.AreEqual("101", manager.ResolveCounter("counter", CounterDigitsGlyphStyle.DEFAULT)); manager.ResetCounter("counter", -5); NUnit.Framework.Assert.AreEqual("-5", manager.ResolveCounter("counter", 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 IncrementCounterTest() { CssCounterManager manager = new CssCounterManager(); manager.ResetCounter("counter"); manager.IncrementCounter("counter"); NUnit.Framework.Assert.AreEqual("1", manager.ResolveCounter("counter", CounterDigitsGlyphStyle.DEFAULT)); manager.IncrementCounter("counter", 101); NUnit.Framework.Assert.AreEqual("102", manager.ResolveCounter("counter", CounterDigitsGlyphStyle.DEFAULT)); manager.IncrementCounter("counter", -3); NUnit.Framework.Assert.AreEqual("99", manager.ResolveCounter("counter", CounterDigitsGlyphStyle.DEFAULT)); manager.IncrementCounter("counter", -101); NUnit.Framework.Assert.AreEqual("-2", manager.ResolveCounter("counter", 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)); }
public virtual void ConvertCounterToSymbolTest() { CssCounterManager manager = new CssCounterManager(); manager.ResetCounter("counter", 3); NUnit.Framework.Assert.AreEqual("3", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (null))); NUnit.Framework.Assert.AreEqual("", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.NONE))); NUnit.Framework.Assert.AreEqual("\u2022", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.DISC))); NUnit.Framework.Assert.AreEqual("\u25a0", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.SQUARE))); NUnit.Framework.Assert.AreEqual("\u25e6", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.CIRCLE))); NUnit.Framework.Assert.AreEqual("C", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ALPHA))); NUnit.Framework.Assert.AreEqual("C", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_LATIN))); NUnit.Framework.Assert.AreEqual("c", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_ALPHA))); NUnit.Framework.Assert.AreEqual("c", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_LATIN))); NUnit.Framework.Assert.AreEqual("\u03b3", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_GREEK))); NUnit.Framework.Assert.AreEqual("iii", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_ROMAN))); NUnit.Framework.Assert.AreEqual("III", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ROMAN))); NUnit.Framework.Assert.AreEqual("03", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.DECIMAL_LEADING_ZERO))); NUnit.Framework.Assert.AreEqual("\u10D2", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.GEORGIAN))); NUnit.Framework.Assert.AreEqual("\u0533", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.ARMENIAN))); NUnit.Framework.Assert.AreEqual("3", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum ("some_script"))); manager.ResetCounter("counter", 0); NUnit.Framework.Assert.AreEqual("0", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (null))); NUnit.Framework.Assert.AreEqual("", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.NONE))); NUnit.Framework.Assert.AreEqual("\u2022", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.DISC))); NUnit.Framework.Assert.AreEqual("\u25a0", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.SQUARE))); NUnit.Framework.Assert.AreEqual("\u25e6", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.CIRCLE))); NUnit.Framework.Assert.AreEqual("0", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ALPHA))); NUnit.Framework.Assert.AreEqual("0", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_LATIN))); NUnit.Framework.Assert.AreEqual("0", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_ALPHA))); NUnit.Framework.Assert.AreEqual("0", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_LATIN))); NUnit.Framework.Assert.AreEqual("0", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_GREEK))); NUnit.Framework.Assert.AreEqual("", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_ROMAN))); NUnit.Framework.Assert.AreEqual("", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ROMAN))); NUnit.Framework.Assert.AreEqual("00", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.DECIMAL_LEADING_ZERO))); NUnit.Framework.Assert.AreEqual("", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.GEORGIAN))); NUnit.Framework.Assert.AreEqual("", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.ARMENIAN))); NUnit.Framework.Assert.AreEqual("0", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum ("some_script"))); manager.ResetCounter("counter", -3); NUnit.Framework.Assert.AreEqual("-3", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (null))); NUnit.Framework.Assert.AreEqual("", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.NONE))); NUnit.Framework.Assert.AreEqual("\u2022", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.DISC))); NUnit.Framework.Assert.AreEqual("\u25a0", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.SQUARE))); NUnit.Framework.Assert.AreEqual("\u25e6", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.CIRCLE))); NUnit.Framework.Assert.AreEqual("-3", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ALPHA))); NUnit.Framework.Assert.AreEqual("-3", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_LATIN))); NUnit.Framework.Assert.AreEqual("-3", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_ALPHA))); NUnit.Framework.Assert.AreEqual("-3", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_LATIN))); NUnit.Framework.Assert.AreEqual("-3", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_GREEK))); NUnit.Framework.Assert.AreEqual("-iii", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_ROMAN))); NUnit.Framework.Assert.AreEqual("-III", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ROMAN))); NUnit.Framework.Assert.AreEqual("0-3", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.DECIMAL_LEADING_ZERO))); NUnit.Framework.Assert.AreEqual("", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.GEORGIAN))); NUnit.Framework.Assert.AreEqual("", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.ARMENIAN))); NUnit.Framework.Assert.AreEqual("-3", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum ("some_script"))); manager.ResetCounter("counter", 5000); NUnit.Framework.Assert.AreEqual("5000", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (null))); NUnit.Framework.Assert.AreEqual("", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.NONE))); NUnit.Framework.Assert.AreEqual("\u2022", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.DISC))); NUnit.Framework.Assert.AreEqual("\u25a0", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.SQUARE))); NUnit.Framework.Assert.AreEqual("\u25e6", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.CIRCLE))); NUnit.Framework.Assert.AreEqual("GJH", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ALPHA))); NUnit.Framework.Assert.AreEqual("GJH", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_LATIN))); NUnit.Framework.Assert.AreEqual("gjh", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_ALPHA))); NUnit.Framework.Assert.AreEqual("gjh", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_LATIN))); NUnit.Framework.Assert.AreEqual("\u03b8\u03c0\u03b8", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_GREEK))); NUnit.Framework.Assert.AreEqual("5000", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.LOWER_ROMAN))); NUnit.Framework.Assert.AreEqual("5000", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.UPPER_ROMAN))); NUnit.Framework.Assert.AreEqual("5000", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.DECIMAL_LEADING_ZERO))); NUnit.Framework.Assert.AreEqual("\u10ed", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.GEORGIAN))); NUnit.Framework.Assert.AreEqual("\u0550", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum (CssConstants.ARMENIAN))); NUnit.Framework.Assert.AreEqual("5000", manager.ResolveCounter("counter", HtmlUtils.ConvertStringCounterGlyphStyleToEnum ("some_script"))); }