示例#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 TestBug17766()
        {
            var data   = Create(@"
class Foo 
{
	$void Bar ()
	{
	}
}
");
            var engine = new CSharpTextEditorIndentation();

            var tww     = new TestWorkbenchWindow();
            var content = new TestViewContent(data);

            tww.ViewContent     = content;
            content.ContentName = "a.cs";
            engine.Initialize(new Document(tww));
            MiscActions.RemoveTab(data);
            engine.KeyPress(Gdk.Key.Tab, '\t', Gdk.ModifierType.ShiftMask);
            CheckOutput(data, @"
class Foo 
{
$void Bar ()
	{
	}
}
", engine);
        }
示例#3
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);
        }
示例#4
0
        public void TestIssue5279()
        {
            var data = CreateData("\n\n\n");

            data.IndentationTracker = new SmartIndentModeTests.TestIndentTracker();
            data.Caret.Location     = new DocumentLocation(2, 3);
            MiscActions.RemoveTab(data);
            Assert.AreEqual("\n\t\n\n", data.Document.Text);
        }
示例#5
0
        public void TestBug615196_UnIndentCase()
        {
            TextEditorData data = new Mono.TextEditor.TextEditorData();

            data.Document.Text = "\n\t\t\n\t\t\n\t\t\n\n";
            data.Caret.Offset  = data.Document.GetLine(2).Offset;             // 2nd.Line
            data.MainSelection = new Selection(2, 1, 4, 1);
            MiscActions.RemoveTab(data);
            MiscActions.RemoveTab(data);

            Assert.AreEqual("\n\n\n\t\t\n\n", data.Document.Text);
        }
示例#6
0
        public void TestRemoveTabWithoutSelection()
        {
            var data = Create(@"
	1
	$2
	3"    );

            MiscActions.RemoveTab(data);
            Check(data, @"
	1
$2
	3"    );
        }
示例#7
0
        public void TestRemoveTab(bool reverse)
        {
            var data = InsertTabTests.Create(
                @"	123456789
	123[456789
	123d456789
	123]456789
	123456789
	123456789"    , reverse);

            MiscActions.RemoveTab(data);

            InsertTabTests.Check(data,
                                 @"	123456789
123[456789
123d456789
123]456789
	123456789
	123456789"    , reverse);
        }
示例#8
0
        public void TestRemoveWithTabsToSpaces()
        {
            var data = Create(@"    123d456789
        123$<-456789
        123d456789
        ->123456789
    123456789
    123456789", new TextEditorOptions()
            {
                TabsToSpaces = true
            });

            MiscActions.RemoveTab(data);
            Check(data, @"    123d456789
    123$<-456789
    123d456789
    ->123456789
    123456789
    123456789");
        }
 bool IEditorOperations.Unindent()
 {
     MiscActions.RemoveTab(widget.TextEditor.GetTextEditorData());
     return(true);
 }