Exemplo n.º 1
0
        protected void FlattenTabStops(TabStops tabStops, TabStops refTabStops)
        {
            if (!tabStops.fClearAll)
            {
                foreach (TabStop refTabStop in refTabStops)
                {
                    if (tabStops.GetTabStopAt(refTabStop.Position) == null && refTabStop.AddTab)
                    {
                        tabStops.AddTabStop(refTabStop.Position, refTabStop.Alignment, refTabStop.Leader);
                    }
                }
            }

            for (int i = 0; i < tabStops.Count; i++)
            {
                TabStop tabStop = tabStops[i];
                if (!tabStop.AddTab)
                {
                    tabStops.RemoveObjectAt(i);
                }
            }
            //Die TabStopCollection ist so wie sie jetzt ist vollständig.
            //Sie darf daher nichts erben, d.h. :
            tabStops.fClearAll = true;
        }
Exemplo n.º 2
0
        public void CtorCopyTest()
        {
            var d0 = new TabStops("(1,2,3)");
            var d1 = new TabStops(d0);

            Assert.Equal(d0, d1);
        }
Exemplo n.º 3
0
        public void CtorStringTest()
        {
            var s0 = "(1,2,3)";
            var d  = new TabStops(s0);

            Assert.Equal(s0, d.ToString());
        }
Exemplo n.º 4
0
        protected void FlattenTabStops(TabStops tabStops, TabStops refTabStops)
        {
            if (!tabStops._fClearAll)
            {
                foreach (TabStop refTabStop in refTabStops)
                {
                    if (tabStops.GetTabStopAt(refTabStop.Position) == null && refTabStop.AddTab)
                    {
                        tabStops.AddTabStop(refTabStop.Position, refTabStop.Alignment, refTabStop.Leader);
                    }
                }
            }

            for (int i = 0; i < tabStops.Count; i++)
            {
                TabStop tabStop = tabStops[i];
                if (!tabStop.AddTab)
                {
                    tabStops.RemoveObjectAt(i);
                }
            }
            // The TabStopCollection is complete now.
            // Prevent inheritence of tab stops.
            tabStops._fClearAll = true;
        }
Exemplo n.º 5
0
        public void CtorEnumerableTest()
        {
            var i0 = new int[] { 1, 2, 3 };
            var s0 = "(1,2,3)";
            var d  = new TabStops(i0);

            Assert.Equal(s0, d.ToString());
        }
Exemplo n.º 6
0
        public void GetPaddingTest()
        {
            var    s0 = "(2,4,6)";
            var    c0 = 2;
            string p1 = "   ";
            var    d  = new TabStops(s0);

            Assert.Equal(p1, d.GetPadding(c0));
        }
Exemplo n.º 7
0
        public void RemoveTabColumnTest()
        {
            var s0 = "(2,4,6)";
            var c0 = 4;
            var s1 = "(2,6)";
            var d  = new TabStops(s0);

            d.RemoveTabstop(c0);
            Assert.Equal(s1, d.ToString());
        }
Exemplo n.º 8
0
 private static void ProcessTabStops(TabStops ts, XmlWriter xmlw)
 {
     xmlw.WriteStartElement("TabStops");
     xmlw.WriteAttributeString("Count", ts.Count.ToStringSafe());
     foreach (TabStop t in ts)
     {
         ProcessTabStop(t, xmlw);
     }
     xmlw.WriteEndElement();
 }
Exemplo n.º 9
0
 private static void ProcessTabStops(TabStops ts, Utf8JsonWriter jsonw)
 {
     jsonw.WritePropertyName("TabStops");
     jsonw.WriteStartObject();
     jsonw.WriteString("Count", ts.Count.ToStringSafe());
     foreach (TabStop t in ts)
     {
         ProcessTabStop(t, jsonw);
     }
     jsonw.WriteEndObject();
 }
Exemplo n.º 10
0
        public void AddTabColumnTest()
        {
            var s0 = "(2,4,6)";
            var c0 = 5;
            var s1 = "(2,4,5,6)";
            var d  = new TabStops(s0);

            d.AddTabStop(-4);
            Assert.Equal(s0, d.ToString());
            d.AddTabStop(c0);
            Assert.Equal(s1, d.ToString());
        }
Exemplo n.º 11
0
        public void GetTabColumnTest()
        {
            var s0 = "(2,4,6)";
            var d0 = new TabStops(s0);

            Assert.Equal(4, d0.GetTabColumn(2));
            Assert.Equal(2, d0.GetTabColumn(-1));
            Assert.Equal(6, d0.GetTabColumn(4));
            var d1 = new TabStops();

            Assert.Equal(1, d1.GetTabColumn(3));
        }
Exemplo n.º 12
0
        public void CtorTest()
        {
            var lm0 = new LineMargins("(2,60,20)");
            var ts0 = new TabStops("(4,10,30)");
            var d0  = new LineFormatter();
            var d1  = new LineFormatter(lm0);
            var d2  = new LineFormatter(lm0, ts0);

            Assert.Equal(new LineMargins(), d0.Margins);
            Assert.Equal(new TabStops(), d1.TabStops);
            Assert.Equal(lm0, d2.Margins);
            Assert.Equal(ts0, d2.TabStops);
        }
Exemplo n.º 13
0
        public void EqualsTest()
        {
            TabStops d00 = null;
            TabStops d01 = new TabStops("(1,2,3)");
            TabStops d02 = new TabStops("(1,2,3)");
            TabStops d03 = new TabStops("(2,4,6)");
            TabStops d04 = new TabStops("(1)");

            Assert.True(d01 == d02);
            Assert.True(d01.Equals(d02));
            Assert.True(d01.GetHashCode() == d02.GetHashCode());
            Assert.True(d01 != d00);
            Assert.False(d00 == d01);
            Assert.False(d03.Equals(d04));
            Assert.False(d02.Equals(d03));
        }
Exemplo n.º 14
0
        public void ListTest()
        {
            var s0 = "(1,2,3)";
            var d  = new TabStops(s0);

            Assert.Equal(1, d[0]);
            Assert.Throws <NotImplementedException>(() => d[0] = 2);
            Assert.Equal(3, d.Count);
            Assert.True(d.IsReadOnly);
            Assert.Throws <NotImplementedException>(() => d.Add(2));
            Assert.Throws <NotImplementedException>(() => d.Clear());
            Assert.Contains(2, d);
            int[] iv0 = { 1, 2, 3 };
            int[] iv1 = new int[3];
            d.CopyTo(iv1, 0);
            Assert.Equal(iv0, iv1);
            Assert.Equal(1, d.IndexOf(2));
            Assert.Throws <NotImplementedException>(() => d.Insert(0, 2));
            Assert.Throws <NotImplementedException>(() => d.Remove(2));
            Assert.Throws <NotImplementedException>(() => d.RemoveAt(0));
        }
Exemplo n.º 15
0
        protected void FlattenTabStops(TabStops tabStops, TabStops refTabStops)
        {
            if (!tabStops._fClearAll)
            {
                foreach (TabStop refTabStop in refTabStops)
                {
                    if (tabStops.GetTabStopAt(refTabStop.Position) == null && refTabStop.AddTab)
                        tabStops.AddTabStop(refTabStop.Position, refTabStop.Alignment, refTabStop.Leader);
                }
            }

            for (int i = 0; i < tabStops.Count; i++)
            {
                TabStop tabStop = tabStops[i];
                if (!tabStop.AddTab)
                    tabStops.RemoveObjectAt(i);
            }
            // The TabStopCollection is complete now.
            // Prevent inheritence of tab stops.
            tabStops._fClearAll = true;
        }
Exemplo n.º 16
0
 protected void FlattenTabStops(TabStops tabStops, TabStops refTabStops)
 {
 }
Exemplo n.º 17
0
    protected void FlattenTabStops(TabStops tabStops, TabStops refTabStops)
    {
      if (!tabStops.fClearAll)
      {
        foreach (TabStop refTabStop in refTabStops)
        {
          if (tabStops.GetTabStopAt(refTabStop.Position) == null && refTabStop.AddTab)
            tabStops.AddTabStop(refTabStop.Position, refTabStop.Alignment, refTabStop.Leader);
        }
      }

      for (int i = 0; i < tabStops.Count; i++)
      {
        TabStop tabStop = tabStops[i];
        if (!tabStop.AddTab)
          tabStops.RemoveObjectAt(i);
      }
      //Die TabStopCollection ist so wie sie jetzt ist vollständig.
      //Sie darf daher nichts erben, d.h. :
      tabStops.fClearAll = true;
    }
Exemplo n.º 18
0
        public void CtorDefaultTest()
        {
            var d = new TabStops();

            Assert.Empty(d);
        }