Пример #1
0
        public static void test_length()
        {
            Textblock tb = new Textblock();

            string text = "1234567";

            /* Add it 32 times to make sure that appending definitely works */
            for (int i = 0; i < 32; i++)
            {
                tb.append(text);
            }

            /* Now make sure it's all right */
            for (int i = 0; i < 32; i++)
            {
                int n      = text.Length;
                int offset = i * n;

                //Original
                //Require(!memcmp(tb_text + offset, text, n));
                Require(tb.Text.Substring(offset, n) == text);
            }

            Ok();
        }
Пример #2
0
        public static void test_alloc()
        {
            Textblock tb = new Textblock();

            Require(tb != null);
            Ok();
        }
Пример #3
0
        public static void test_append()
        {
            Textblock tb = new Textblock();

            Require(tb.Text == "");

            tb.append("Hello");
            Require(tb.Text == "Hello");

            tb.append("{0}", 20);
            Require(tb.Text == "Hello20");

            Ok();
        }
Пример #4
0
        public static void test_colour()
        {
            Textblock tb = new Textblock();

            string text = "two";

            //These were all TERM_L_GREEN
            ConsoleColor[] attrs = new ConsoleColor[] { ConsoleColor.Green, ConsoleColor.Green, ConsoleColor.Green };

            tb.append_c(ConsoleColor.Green, text);

            for (int i = 0; i < attrs.Length; i++)
            {
                Require(tb.Attributes[i] == attrs[i]);
            }

            Ok();
        }