Esempio n. 1
0
        public void MastNotFail_4_1()
        {
            LineArray  lines      = new LineArray(4);
            Controller controller = new Controller(lines);

            lines.SetText(File.ReadAllText("../test_code_4.txt"));

            controller.PutCursor(new Place(1, 56 - 1), false);
            controller.PutNewCursor(new Place(1, 59 - 1));
            controller.PutNewCursor(new Place(1, 61 - 1));
            controller.PutNewCursor(new Place(1, 67 - 1));
            controller.PutNewCursor(new Place(1, 69 - 1));
            controller.PutNewCursor(new Place(1, 79 - 1));
            controller.PutNewCursor(new Place(1, 145 - 1));
            controller.PutNewCursor(new Place(1, 168 - 1));
            controller.PutNewCursor(new Place(1, 171 - 1));
            controller.PutNewCursor(new Place(1, 316 - 1));
            controller.PutNewCursor(new Place(1, 321 - 1));
            controller.PutNewCursor(new Place(1, 326 - 1));
            controller.PutNewCursor(new Place(1, 342 - 1));
            controller.MoveDown(true);
            controller.MoveDown(true);

            controller.EraseSelection();

            Assert.AreEqual(File.ReadAllText("../test_code_4_1_after.txt"), lines.GetText());
        }
Esempio n. 2
0
        public void MastNotFail_3()
        {
            LineArray  lines      = new LineArray(3);
            Controller controller = new Controller(lines);

            lines.SetText(File.ReadAllText("../test_code_3.txt"));
            controller.PutCursor(new Place(1, 45), false);
            controller.PutCursor(new Place(1, 44), true);
            controller.EraseSelection();
            Assert.AreEqual(File.ReadAllText("../test_code_3_after.txt"), lines.GetText());
        }
Esempio n. 3
0
        public void MastNotFail_2()
        {
            LineArray  lines      = new LineArray(10);
            Controller controller = new Controller(lines);

            lines.SetText(File.ReadAllText("../test_code_2.txt"));
            controller.PutCursor(new Place(0, 9), false);
            controller.PutCursor(new Place(0, 20), true);
            controller.Cut();
            Assert.AreEqual(File.ReadAllText("../test_code_2_after.txt"), lines.GetText());
        }
Esempio n. 4
0
        public void MastNotFail_1()
        {
            LineArray  lines      = new LineArray(100);
            Controller controller = new Controller(lines);

            lines.SetText(GetTextExample());
            controller.PutCursor(new Place(0, 299), false);
            controller.PutCursor(new Place(0, 298), true);
            controller.Cut();
            controller.PutCursor(new Place(0, 305), false);
            controller.Paste();
            Assert.AreEqual(File.ReadAllText("../test_code_after.txt"), lines.GetText());
        }
Esempio n. 5
0
        public void MastNotFail_4()
        {
            LineArray  lines      = new LineArray(4);
            Controller controller = new Controller(lines);

            lines.SetText(File.ReadAllText("../test_code_4.txt"));

            controller.PutCursor(new Place(1, 316 - 1), false);
            controller.PutCursor(new Place(1, 316 - 0), true);

            controller.PutNewCursor(new Place(1, 321 - 1));
            controller.PutCursor(new Place(1, 321 - 0), true);

            controller.EraseSelection();

            Assert.AreEqual(File.ReadAllText("../test_code_4_after.txt"), lines.GetText());
        }
Esempio n. 6
0
 protected ControllerTestBase AssertText(string text)
 {
     Assert.AreEqual(text, lines.GetText());
     Assert.AreEqual(text.Length, lines.charsCount, "Chars count");
     return(this);
 }
Esempio n. 7
0
        public void GetText_Simple()
        {
            Init();

            lines.SetText("line0\nline1 text\r\nline3");
            CollectionAssert.AreEqual(new string[] { "line0\n", "line1 text\r\n", "line3" }, lines.Debug_GetLinesText());

            // line0N
            // line1 textRN
            // line3

            Assert.AreEqual("l", lines.GetText(0, 1));
            Assert.AreEqual("in", lines.GetText(1, 2));
            Assert.AreEqual("ine0", lines.GetText(1, 4));
            Assert.AreEqual("ine0\n", lines.GetText(1, 5));

            Assert.AreEqual("l", lines.GetText(6, 1));
            Assert.AreEqual("li", lines.GetText(6, 2));
            Assert.AreEqual("ne1 text\r", lines.GetText(8, 9));
            Assert.AreEqual("ne1 text\r\n", lines.GetText(8, 10));

            Assert.AreEqual("in", lines.GetText(19, 2));
            Assert.AreEqual("e", lines.GetText(21, 1));
            Assert.AreEqual("e3", lines.GetText(21, 2));

            Assert.AreEqual("line0\nline", lines.GetText(0, 10));
            Assert.AreEqual("e0\nline1 t", lines.GetText(3, 10));
            Assert.AreEqual("line0\nline1 text\r\nline3", lines.GetText(0, 23));
            Assert.AreEqual("ine0\nline1 text\r\nlin", lines.GetText(1, 20));
        }