Beispiel #1
0
        public void TestVSTS524616()
        {
            var document = new Mono.TextEditor.TextDocument();

            document.Text = "test";
            string txt;

            document.TextChanging += delegate {
                txt = document.Text;
            };
            document.InsertText(0, "test");
            Assert.AreEqual("testtest", document.Text);
        }
Beispiel #2
0
        public void TestDocumentBug2Test()
        {
            var document = new Mono.TextEditor.TextDocument();

            string top      = "123\n456\n789\n0";
            string testText = "Hello World!";

            document.Text = top;

            document.InsertText(top.Length, testText);

            DocumentLine line = document.GetLine(document.LineCount);

            Assert.AreEqual(top.Length - 1, line.Offset);
            Assert.AreEqual(testText.Length + 1, line.LengthIncludingDelimiter);
        }
Beispiel #3
0
        public void TestDocumentInsert()
        {
            var document = new Mono.TextEditor.TextDocument();

            string top  = "1234567890\n";
            string text =
                "12345678\n" +
                "1234567\n" +
                "123456\n" +
                "12345\n" +
                "1234\n" +
                "123\n" +
                "12\n" +
                "1\n" +
                "\n";

            document.Text = top;
            document.InsertText(top.Length, text);
            Assert.AreEqual(top + text, document.Text);
        }
Beispiel #4
0
        public void SplitterTest()
        {
            var document = new Mono.TextEditor.TextDocument();

            for (int i = 0; i < 100; i++)
            {
                document.InsertText(0, new string ('c', i) + Environment.NewLine);
            }
            Assert.AreEqual(101, document.LineCount);
            for (int i = 0; i < 100; i++)
            {
                DocumentLine line = document.GetLine(i + 1);
                Assert.AreEqual(99 - i, line.Length);
                Assert.AreEqual(Environment.NewLine.Length, line.DelimiterLength);
            }

            for (int i = 0; i < 100; i++)
            {
                DocumentLine line = document.GetLine(1);
                document.RemoveText(line.Length, line.DelimiterLength);
            }
            Assert.AreEqual(1, document.LineCount);
        }