Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2015-03-13 21:02:20 +0300
committerMike Krüger <mkrueger@xamarin.com>2015-03-13 21:02:36 +0300
commit11fed8114d10fb78543740ab7a835a2b0c7e6da9 (patch)
tree0248c9f26d64e93e4a846f6866063ed5d9239357 /main/src/core/MonoDevelop.TextEditor.Tests
parent4f8466da0f98124218ef422850af521cd1a92f0b (diff)
[TextEditor] Added some more unit tests for the smart backspace.
Diffstat (limited to 'main/src/core/MonoDevelop.TextEditor.Tests')
-rw-r--r--main/src/core/MonoDevelop.TextEditor.Tests/Mono.TextEditor.Tests/VirtualIndentModeTests.cs34
1 files changed, 30 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.TextEditor.Tests/Mono.TextEditor.Tests/VirtualIndentModeTests.cs b/main/src/core/MonoDevelop.TextEditor.Tests/Mono.TextEditor.Tests/VirtualIndentModeTests.cs
index e30c1c1444..32b47642fc 100644
--- a/main/src/core/MonoDevelop.TextEditor.Tests/Mono.TextEditor.Tests/VirtualIndentModeTests.cs
+++ b/main/src/core/MonoDevelop.TextEditor.Tests/Mono.TextEditor.Tests/VirtualIndentModeTests.cs
@@ -218,7 +218,7 @@ namespace Mono.TextEditor.Tests
data.InsertAtCaret (" ");
Assert.AreEqual ("\n\t\t \n\n", data.Document.Text);
DeleteActions.Backspace (data);
- Assert.AreEqual ("\n\n\n", data.Document.Text);
+ Assert.AreEqual ("\n\n", data.Document.Text);
Assert.AreEqual (data.IndentationTracker.GetVirtualIndentationColumn (2, 1), data.Caret.Column);
}
@@ -252,7 +252,7 @@ namespace Mono.TextEditor.Tests
data.Caret.Location = new DocumentLocation (2, 4);
DeleteActions.Backspace (data);
Assert.AreEqual (3, data.Caret.Column);
- Assert.AreEqual ("\n\n\n", data.Document.Text);
+ Assert.AreEqual ("\n\n", data.Document.Text);
}
[Test]
@@ -261,8 +261,8 @@ namespace Mono.TextEditor.Tests
var data = CreateData ("\n\t\n\n");
data.Caret.Location = new DocumentLocation (2, 2);
DeleteActions.Backspace (data);
- Assert.AreEqual ("\n\n\n", data.Document.Text);
- Assert.AreEqual (1, data.Caret.Column);
+ Assert.AreEqual ("\n\n", data.Document.Text);
+ Assert.AreEqual (0, data.Caret.Offset);
}
[Test]
@@ -478,6 +478,32 @@ namespace Mono.TextEditor.Tests
Assert.AreEqual (new DocumentLocation (2, 7), data.Caret.Location);
Assert.AreEqual ("\n\t\tTest", data.Document.Text);
}
+
+ [Test]
+ public void TestEmptyLineSmartBackspace ()
+ {
+ var data = CreateData ("\n\n\n\n");
+ data.IndentationTracker = new SmartIndentModeTests.TestIndentTracker ("\t");
+ data.Caret.Location = new DocumentLocation (3, 2);
+ DeleteActions.Backspace (data);
+ Assert.AreEqual (new DocumentLocation (2, 2), data.Caret.Location);
+ Assert.AreEqual ("\n\n\n", data.Document.Text);
+ DeleteActions.Backspace (data);
+ Assert.AreEqual (new DocumentLocation (1, 2), data.Caret.Location);
+ Assert.AreEqual ("\n\n", data.Document.Text);
+ }
+
+
+ [Test]
+ public void TestSmartExistingLineBackspace ()
+ {
+ var data = CreateData ("\n\t\t\n\t\tTest");
+ data.Caret.Location = new DocumentLocation (3, 3);
+ DeleteActions.Backspace (data);
+ Assert.AreEqual (new DocumentLocation (2, 3), data.Caret.Location);
+ Assert.AreEqual ("\n\t\tTest", data.Document.Text);
+ }
+
}
}