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 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 ResolveCounterTest() { CssCounterManager manager = new CssCounterManager(); manager.ResetCounter("counter1", 1); NUnit.Framework.Assert.AreEqual("1", manager.ResolveCounter("counter1", CounterDigitsGlyphStyle.DEFAULT)); NUnit.Framework.Assert.AreEqual("0", manager.ResolveCounter("counter2", CounterDigitsGlyphStyle.DEFAULT)); IElementNode node = new CssPseudoElementNode(null, "name"); manager.PushEveryCounterToCounters(node); manager.ResetCounter("counter2", 1); manager.IncrementCounter("counter1", 2); NUnit.Framework.Assert.AreEqual("3", manager.ResolveCounter("counter1", CounterDigitsGlyphStyle.DEFAULT)); NUnit.Framework.Assert.AreEqual("1", manager.ResolveCounter("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 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"))); }