Пример #1
0
        public void TestRemoveTabReverse()
        {
            TextEditorData data = new Mono.TextEditor.TextEditorData();

            data.Document.Text =
                @"\t123456789
\t123[456789
\t123d456789
\t123]456789
\t123456789
\t123456789";
            InsertTabTests.SetSelection(data, true);

            MiscActions.RemoveTab(data);

/*			ISegment currentSelection = InsertTabTests.GetSelection (data, true);
 *
 *                      Assert.AreEqual (currentSelection.Offset, data.SelectionRange.Offset);
 *                      Assert.AreEqual (currentSelection.EndOffset, data.SelectionRange.EndOffset);
 *                      Assert.AreEqual (currentSelection.Offset, data.Caret.Offset);
 *                      Assert.AreEqual (currentSelection.EndOffset, data.SelectionAnchor);*/

            Assert.IsTrue(data.Document.GetLine(0).Length < data.Document.GetLine(1).Length);
            Assert.IsTrue(data.Document.GetLine(0).Length < data.Document.GetLine(2).Length);
            Assert.IsTrue(data.Document.GetLine(0).Length < data.Document.GetLine(3).Length);

            Assert.AreEqual(data.Document.GetLine(0).Length, data.Document.GetLine(4).Length);

            Assert.AreEqual(data.Document.GetLine(1).Length, data.Document.GetLine(2).Length);
            Assert.AreEqual(data.Document.GetLine(1).Length, data.Document.GetLine(3).Length);
        }
Пример #2
0
        public void TestRemoveTabCase2()
        {
            TextEditorData data = new Mono.TextEditor.TextEditorData();

            data.Document.Text =
                @"\t123456789
[\t123456789
\t123d456789
\t123]456789
\t123456789
\t123456789";
            InsertTabTests.SetSelection(data, false);

            MiscActions.RemoveTab(data);

/*			ISegment currentSelection = InsertTabTests.GetSelection (data, false);
 *
 *                      Assert.AreEqual (currentSelection.Offset, data.SelectionRange.Offset);
 *                      Assert.AreEqual (currentSelection.EndOffset, data.SelectionRange.EndOffset);
 *                      Assert.AreEqual (currentSelection.EndOffset, data.Caret.Offset);
 *                      Assert.AreEqual (currentSelection.Offset, data.SelectionAnchor);
 *                      Assert.AreEqual (currentSelection.Offset, data.Document.GetLine (DocumentLocation.MinLine + 1).Offset);*/

            Assert.IsTrue(data.Document.GetLine(DocumentLocation.MinLine + 0).Length < data.Document.GetLine(DocumentLocation.MinLine + 1).Length);
            Assert.IsTrue(data.Document.GetLine(DocumentLocation.MinLine + 0).Length < data.Document.GetLine(DocumentLocation.MinLine + 2).Length);
            Assert.IsTrue(data.Document.GetLine(DocumentLocation.MinLine + 0).Length < data.Document.GetLine(DocumentLocation.MinLine + 3).Length);

            Assert.AreEqual(data.Document.GetLine(DocumentLocation.MinLine + 0).Length, data.Document.GetLine(DocumentLocation.MinLine + 4).Length);

            Assert.AreEqual(data.Document.GetLine(DocumentLocation.MinLine + 1).Length, data.Document.GetLine(DocumentLocation.MinLine + 2).Length);
            Assert.AreEqual(data.Document.GetLine(DocumentLocation.MinLine + 1).Length, data.Document.GetLine(DocumentLocation.MinLine + 3).Length);
        }