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