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; }
public void CtorCopyTest() { var d0 = new TabStops("(1,2,3)"); var d1 = new TabStops(d0); Assert.Equal(d0, d1); }
public void CtorStringTest() { var s0 = "(1,2,3)"; var d = new TabStops(s0); Assert.Equal(s0, d.ToString()); }
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; }
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()); }
public void GetPaddingTest() { var s0 = "(2,4,6)"; var c0 = 2; string p1 = " "; var d = new TabStops(s0); Assert.Equal(p1, d.GetPadding(c0)); }
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()); }
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(); }
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(); }
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()); }
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)); }
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); }
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)); }
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)); }
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; }
protected void FlattenTabStops(TabStops tabStops, TabStops refTabStops) { }
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; }
public void CtorDefaultTest() { var d = new TabStops(); Assert.Empty(d); }