Exemple #1
0
        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));
        }
Exemple #2
0
        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)));
        }