Beispiel #1
0
        public void TextGrid_CellFormats()
        {
            var grid = new TextGrid();

            grid.SetCellFormat(0, 0, new TextGridFormat(TextGridAlign.Default, 5));
            grid[0, 0] = "a";
            Assert.AreEqual("a    \r\n", grid.ToString());

            grid.SetColumnFormat(0, new TextGridFormat(TextGridAlign.Default, 1));
            Assert.AreEqual("a    \r\n", grid.ToString());

            grid.SetColumnFormat(0, new TextGridFormat(TextGridAlign.Right, 1));
            Assert.AreEqual("    a\r\n", grid.ToString());

            grid.SetColumnFormat(0, new TextGridFormat(TextGridAlign.Right, 5));
            grid.SetCellFormat(0, 0, new TextGridFormat(TextGridAlign.Default, 5));
            grid[0, 1] = "bb";
            Assert.AreEqual("    a\r\n   bb\r\n", grid.ToString());

            grid.SetCellFormat(0, 0, new TextGridFormat(TextGridAlign.Left, 5));
            Assert.AreEqual("a    \r\n   bb\r\n", grid.ToString());

            grid.SetCellFormat(0, 0, new TextGridFormat(TextGridAlign.Right, 5));
            Assert.AreEqual("    a\r\n   bb\r\n", grid.ToString());

            grid.SetCellFormat(0, 1, new TextGridFormat(TextGridAlign.Left, 5));
            Assert.AreEqual("    a\r\nbb   \r\n", grid.ToString());
        }
Beispiel #2
0
        public void TextGrid_FillChar()
        {
            var grid = new TextGrid();

            grid.SetCellFormat(0, 0, new TextGridFormat('-'));
            grid[0, 0] = "";
            grid[0, 1] = "abcd";
            Assert.AreEqual("----\r\nabcd\r\n", grid.ToString());

            grid.Clear();
            grid.SetCellFormat(0, 1, new TextGridFormat('-'));
            grid[0, 0] = "abcd";
            grid[0, 1] = "efghijklmno";
            Assert.AreEqual("abcd\r\n----\r\n", grid.ToString());
        }