public void TestTableLayoutNineItemsTwoRows() { Vector2 size = new Vector2(18, 3); List <string> lines = new List <string>(); lines.Add("1111"); lines.Add("2222"); lines.Add("3333"); lines.Add("4444"); lines.Add("5555"); lines.Add("6666"); lines.Add("7777"); lines.Add("8888"); lines.Add("9999"); ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines.ToArray()); entry.Layout(this, size.x); AssertCellEntryLayout(entry, size, "1111" + kSpace + "4444" + kSpace + "7777" + "\n" + "2222" + kSpace + "5555" + kSpace + "8888" + "\n" + "3333" + kSpace + "6666" + kSpace + "9999" ); }
public void Add(LogLevel level, Tag tag, string line) { ConsoleViewCellEntry entry = new ConsoleViewCellEntry(line); entry.level = level; entry.tag = tag; Add(entry); }
////////////////////////////////////////////////////////////////////////////// #region IConsoleDelegate implementation public void OnConsoleEntryAdded(AbstractConsole console, ref ConsoleViewCellEntry entry) { if (entry.IsTable) { string[] table = entry.Table; foreach (string item in table) { terminalTableOutput.Add(StringUtils.RemoveRichTextTags(item)); } } }
public void TestFlowLayoutSinglelWordMoreThanMaxWidth() { Vector2 size = new Vector2(5, 1); string line = "12345"; ConsoleViewCellEntry entry = new ConsoleViewCellEntry(line); entry.Layout(this, size.x - 1); AssertCellEntryLayout(entry, size, "12345" ); }
public void TestTableLayoutThreeItemsSingleRow() { Vector2 size = new Vector2(18, 1); string[] lines = { "111", "22", "3333" }; ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines); entry.Layout(this, size.x); AssertCellEntryLayout(entry, size, "111 " + kSpace + "22 " + kSpace + "3333" ); }
public void TestTableLayoutSingleItem() { Vector2 size = new Vector2(14, 1); string[] lines = { "1111" }; ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines); entry.Layout(this, size.x); AssertCellEntryLayout(entry, size, "1111" ); }
public void TestTableLayoutFourItemsTwoRows() { Vector2 size = new Vector2(14, 2); string[] lines = { "1111", "2222", "3333", "4444" }; ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines); entry.Layout(this, size.x); AssertCellEntryLayout(entry, size, "1111" + kSpace + "3333" + "\n" + "2222" + kSpace + "4444" ); }
public void TestTableLayoutSingleLongItemDontFit() { Vector2 size = new Vector2(3, 1); List <string> lines = new List <string>(); lines.Add("1111"); ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines.ToArray()); entry.Layout(this, size.x); AssertCellEntryLayout(entry, size, "1111" ); }
public void TestTableLayoutTwoItemsDifferentSizeSingleRow() { Vector2 size = new Vector2(18, 1); List <string> lines = new List <string>(); lines.Add("1111"); lines.Add("222222"); ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines.ToArray()); entry.Layout(this, size.x); AssertCellEntryLayout(entry, size, "1111 " + kSpace + "222222" ); }
public void TestTableLayoutTwoItemsDifferentSizeThreeRows() { Vector2 size = new Vector2(14, 3); List <string> lines = new List <string>(); lines.Add("1111"); lines.Add("222222"); lines.Add("333333333"); ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines.ToArray()); entry.Layout(this, size.x); AssertCellEntryLayout(entry, size, "1111" + "\n" + "222222" + "\n" + "333333333" ); }
public void TestCompositeFilterRemove() { List <int> priorities = new List <int>(); ConsoleViewFilterBase filter1 = new TestFilter(1, delegate(ref ConsoleViewCellEntry e) { priorities.Add(1); return(true); }); ConsoleViewFilterBase filter2 = new TestFilter(2, delegate(ref ConsoleViewCellEntry e) { priorities.Add(2); return(true); }); ConsoleViewFilterBase filter3 = new TestFilter(3, delegate(ref ConsoleViewCellEntry e) { priorities.Add(3); return(true); }); ConsoleViewCompositeFilter compositeFilter = new ConsoleViewCompositeFilter(); compositeFilter.AddFilter(filter1); compositeFilter.AddFilter(filter2); compositeFilter.AddFilter(filter3); compositeFilter.RemoveFilter(filter1); compositeFilter.RemoveFilter(filter3); ConsoleViewCellEntry entry = default(ConsoleViewCellEntry); compositeFilter.Apply(ref entry); AssertList(priorities, 2); }
public override bool Apply(ref ConsoleViewCellEntry entry) { return(m_delegate(ref entry)); }
private void AssertCellEntryLayout(ConsoleViewCellEntry entry, Vector2 expectedSize, string expectedValue) { Assert.AreEqual(expectedValue, entry.value); Assert.AreEqual(expectedSize.x, entry.width); Assert.AreEqual(expectedSize.y, entry.height); }