public void TestDocumentBug2Test() { var document = new Mono.TextEditor.TextDocument(); string top = "123\n456\n789\n0"; string testText = "Hello World!"; document.Text = top; document.Insert(top.Length, testText); DocumentLine line = document.GetLine(document.LineCount); Assert.AreEqual(top.Length - 1, line.Offset); Assert.AreEqual(testText.Length + 1, line.LengthIncludingDelimiter); }
public void SplitterTest() { var document = new Mono.TextEditor.TextDocument (); for (int i = 0; i < 100; i++) { document.Insert (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.Remove (line.Length, line.DelimiterLength); } Assert.AreEqual (1, document.LineCount); }
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.Insert(top.Length, text); Assert.AreEqual(top + text, document.Text); }
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.Insert (top.Length, text); Assert.AreEqual (top + text, document.Text); }
public void SplitterTest() { var document = new Mono.TextEditor.TextDocument(); for (int i = 0; i < 100; i++) { document.Insert(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.Remove(line.Length, line.DelimiterLength); } Assert.AreEqual(1, document.LineCount); }
public void TestDocumentBug2Test() { var document = new Mono.TextEditor.TextDocument (); string top = "123\n456\n789\n0"; string testText = "Hello World!"; document.Text = top; document.Insert (top.Length, testText); DocumentLine line = document.GetLine (document.LineCount); Assert.AreEqual (top.Length - 1, line.Offset); Assert.AreEqual (testText.Length + 1, line.LengthIncludingDelimiter); }