Exemplo n.º 1
0
        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");

            CConsoleViewCellEntry entry = new CConsoleViewCellEntry(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"
                                  );
        }
Exemplo n.º 2
0
        public void Add(CLogLevel level, CTag tag, string line)
        {
            CConsoleViewCellEntry entry = new CConsoleViewCellEntry(line);

            entry.level = level;
            entry.tag   = tag;
            Add(entry);
        }
Exemplo n.º 3
0
        //////////////////////////////////////////////////////////////////////////////

        #region IConsoleDelegate implementation

        public void OnConsoleEntryAdded(CAbstractConsole console, ref CConsoleViewCellEntry entry)
        {
            if (entry.IsTable)
            {
                string[] table = entry.Table;
                foreach (string item in table)
                {
                    terminalTableOutput.Add(CStringUtils.RemoveRichTextTags(item));
                }
            }
        }
Exemplo n.º 4
0
        public void TestFlowLayoutSinglelWordMoreThanMaxWidth()
        {
            Vector2 size = new Vector2(5, 1);

            string line = "12345";
            CConsoleViewCellEntry entry = new CConsoleViewCellEntry(line);

            entry.Layout(this, size.x - 1);

            AssertCellEntryLayout(entry, size,
                                  "12345"
                                  );
        }
Exemplo n.º 5
0
        public void TestTableLayoutThreeItemsSingleRow()
        {
            Vector2 size = new Vector2(18, 1);

            string[] lines = { "111", "22", "3333" };

            CConsoleViewCellEntry entry = new CConsoleViewCellEntry(lines);

            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                                  "111 " + kSpace + "22  " + kSpace + "3333"
                                  );
        }
Exemplo n.º 6
0
        public void TestTableLayoutSingleItem()
        {
            Vector2 size = new Vector2(14, 1);

            string[] lines = { "1111" };

            CConsoleViewCellEntry entry = new CConsoleViewCellEntry(lines);

            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                                  "1111"
                                  );
        }
Exemplo n.º 7
0
        public void TestTableLayoutFourItemsTwoRows()
        {
            Vector2 size = new Vector2(14, 2);

            string[] lines = { "1111", "2222", "3333", "4444" };

            CConsoleViewCellEntry entry = new CConsoleViewCellEntry(lines);

            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                                  "1111" + kSpace + "3333" + "\n" +
                                  "2222" + kSpace + "4444"
                                  );
        }
Exemplo n.º 8
0
        public void TestTableLayoutSingleLongItemDontFit()
        {
            Vector2 size = new Vector2(3, 1);

            List <string> lines = new List <string>();

            lines.Add("1111");

            CConsoleViewCellEntry entry = new CConsoleViewCellEntry(lines.ToArray());

            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                                  "1111"
                                  );
        }
Exemplo n.º 9
0
        public void TestTableLayoutTwoItemsDifferentSizeSingleRow()
        {
            Vector2 size = new Vector2(18, 1);

            List <string> lines = new List <string>();

            lines.Add("1111");
            lines.Add("222222");

            CConsoleViewCellEntry entry = new CConsoleViewCellEntry(lines.ToArray());

            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                                  "1111  " + kSpace + "222222"
                                  );
        }
Exemplo n.º 10
0
        public void TestTableLayoutTwoItemsDifferentSizeThreeRows()
        {
            Vector2 size = new Vector2(14, 3);

            List <string> lines = new List <string>();

            lines.Add("1111");
            lines.Add("222222");
            lines.Add("333333333");

            CConsoleViewCellEntry entry = new CConsoleViewCellEntry(lines.ToArray());

            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                                  "1111" + "\n" +
                                  "222222" + "\n" +
                                  "333333333"
                                  );
        }
Exemplo n.º 11
0
        public void TestCompositeFilterRemove()
        {
            List <int> priorities = new List <int>();

            CConsoleViewFilterBase filter1 = new TestFilter(1, delegate(ref CConsoleViewCellEntry e)
            {
                priorities.Add(1);
                return(true);
            });

            CConsoleViewFilterBase filter2 = new TestFilter(2, delegate(ref CConsoleViewCellEntry e)
            {
                priorities.Add(2);
                return(true);
            });

            CConsoleViewFilterBase filter3 = new TestFilter(3, delegate(ref CConsoleViewCellEntry e)
            {
                priorities.Add(3);
                return(true);
            });

            CConsoleViewCompositeFilter compositeFilter = new CConsoleViewCompositeFilter();

            compositeFilter.AddFilter(filter1);
            compositeFilter.AddFilter(filter2);
            compositeFilter.AddFilter(filter3);

            compositeFilter.RemoveFilter(filter1);
            compositeFilter.RemoveFilter(filter3);

            CConsoleViewCellEntry entry = default(CConsoleViewCellEntry);

            compositeFilter.Apply(ref entry);

            AssertList(priorities, 2);
        }
Exemplo n.º 12
0
 public override bool Apply(ref CConsoleViewCellEntry entry)
 {
     return(m_delegate(ref entry));
 }
Exemplo n.º 13
0
 private void AssertCellEntryLayout(CConsoleViewCellEntry entry, Vector2 expectedSize, string expectedValue)
 {
     Assert.AreEqual(expectedValue, entry.value);
     Assert.AreEqual(expectedSize.x, entry.width);
     Assert.AreEqual(expectedSize.y, entry.height);
 }