public void TestIsFoldedUnsetFolded() { var data = CaretMoveActionTests.Create( @"-[1 2 3 +[4 5 +[6 7] 8] -[9 10 11] 12] -[13 14] 15 16"); var segments = GetFoldSegments(data.Document); data.Document.UpdateFoldSegments(segments, false); Assert.AreEqual(11, data.LogicalToVisualLine(15)); data.Document.GetStartFoldings(6).First().IsFolded = false; data.Document.GetStartFoldings(4).First().IsFolded = false; Assert.AreEqual(15, data.LogicalToVisualLine(15)); }
public void TestUpdateFoldSegmentBug2() { var data = CaretMoveActionTests.Create( @"-[1 2 +[3 4] 5 +[6 7] 8 9 10 11 12 13 14] 15 16"); var segments = GetFoldSegments(data.Document); data.Document.UpdateFoldSegments(segments, false); Assert.AreEqual(10, data.VisualToLogicalLine(8)); Assert.AreEqual(3, data.Document.FoldSegments.Count()); int start = data.GetLine(2).Offset; int end = data.GetLine(8).Offset; data.Remove(start, end - start); Assert.AreEqual(1, data.Document.FoldSegments.Count()); Assert.AreEqual(10, data.LogicalToVisualLine(10)); }
public void TestGetStartFoldingsGetStartFoldings() { var data = CaretMoveActionTests.Create( @"+[1 2 3 +[4 5 +[6 7] 8] +[9 10 11] 12] +[13 14] 15 16"); var segments = GetFoldSegments(data.Document); data.Document.UpdateFoldSegments(segments, false); data.Document.UpdateFoldSegments(segments, false); data.Document.UpdateFoldSegments(segments, false); Assert.AreEqual(1, data.Document.GetStartFoldings(1).Count()); Assert.AreEqual(1, data.Document.GetStartFoldings(4).Count()); Assert.AreEqual(1, data.Document.GetStartFoldings(6).Count()); Assert.AreEqual(1, data.Document.GetStartFoldings(9).Count()); Assert.AreEqual(1, data.Document.GetStartFoldings(13).Count()); }
public void TestVisualToLogicalLineCase2() { var data = CaretMoveActionTests.Create( @"-[1 +[2 3 ]4 5 +[6 +[7 +[8 9 ]10 ]11 ]12 ]13 14 +[15 16 ]17 18"); data.Document.UpdateFoldSegments(GetFoldSegments(data.Document), false); Assert.AreEqual(6, data.VisualToLogicalLine(4)); Assert.AreEqual(14, data.VisualToLogicalLine(6)); Assert.AreEqual(15, data.VisualToLogicalLine(7)); }
public void TestVisualToLogicalLine() { var data = CaretMoveActionTests.Create( @"-[0 +[1 2 ]3 4 +[5 +[6 +[7 8 ]9 ]10 ]11 ]12 13 +[14 15 ]16 17"); data.Document.UpdateFoldSegments(GetFoldSegments(data.Document), false); Assert.AreEqual(13, data.VisualToLogicalLine(5)); Assert.AreEqual(18, data.VisualToLogicalLine(8)); }
public void TestLogicalToVisualLine() { var data = CaretMoveActionTests.Create( @"-[1 +[2 3 ]4 5 +[6 +[7 +[8 9 ]10 ]11 ]12 ]13 14 +[15 16 ]17 18"); data.Document.UpdateFoldSegments(GetFoldSegments(data.Document), false); Assert.AreEqual(5, data.LogicalToVisualLine(12)); Assert.AreEqual(8, data.LogicalToVisualLine(16)); Assert.AreEqual(8, data.LogicalToVisualLine(17)); }
public void TestBug1134() { var data = CaretMoveActionTests.Create( @"0 1 -[2 3 4] 5 -[6 7 +[8 9] 10] 11"); var segments = GetFoldSegments(data.Document); var seg = segments[0]; segments.RemoveAt(0); data.Document.UpdateFoldSegments(segments, false); Assert.AreEqual(2, data.Document.FoldSegments.Count()); segments.Insert(0, seg); data.Document.UpdateFoldSegments(segments, false); Assert.AreEqual(3, data.Document.FoldSegments.Count()); }
public void TestVisualToLogicalLineStartLine() { var data = CaretMoveActionTests.Create( @"-[1 -[2 3 ]4 5 -[6 +[7 -[8 9 ]10 ]11 ]12 ]13 14 -[15 16 ]17 18"); data.Document.UpdateFoldSegments(GetFoldSegments(data.Document), false); Assert.AreEqual(7, data.VisualToLogicalLine(7)); }
public void TestBackspaceDeleteCase1() { TextEditorData data = CaretMoveActionTests.Create(@"1234567890$"); DeleteActions.Delete(data); Assert.AreEqual(new DocumentLocation(0, 10), data.Caret.Location); Assert.AreEqual("1234567890", data.Document.Text); }
public void TestDelete() { TextEditorData data = CaretMoveActionTests.Create(@"1234$567890"); Assert.AreEqual(new DocumentLocation(0, 4), data.Caret.Location); DeleteActions.Delete(data); Assert.AreEqual(new DocumentLocation(0, 4), data.Caret.Location); Assert.AreEqual("123467890", data.Document.Text); }
public void TestDeleteCaretLine() { TextEditorData data = CaretMoveActionTests.Create(@"1234567890 1234$67890 1234567890"); DeleteActions.CaretLine(data); Assert.AreEqual(@"1234567890 1234567890", data.Document.Text); }
public void TestMoveToDocumentStart() { TextEditorData data = CaretMoveActionTests.Create(@"1234567890 1234567890 1234$567890 1234567890 1234567890"); SelectionActions.MoveToDocumentStart(data); Assert.AreEqual(new Selection(2, 4, 0, 0), data.MainSelection); }
public void TestMoveToDocumentStart() { TextEditorData data = CaretMoveActionTests.Create(@"1234567890 1234567890 1234$567890 1234567890 1234567890"); SelectionActions.MoveToDocumentStart(data); Assert.AreEqual(new Selection(DocumentLocation.MinLine + 2, DocumentLocation.MinColumn + 4, DocumentLocation.MinLine, DocumentLocation.MinColumn), data.MainSelection); }
public void TestMoveUp() { TextEditorData data = CaretMoveActionTests.Create(@"1234567890 1234567890 1234$567890 1234567890 1234567890"); SelectionActions.MoveUp(data); Assert.AreEqual(new Selection(2, 4, 1, 4), data.MainSelection); }
public void TestCaretLeft() { var data = CaretMoveActionTests.Create( @"1234567890 1234567890 1234+[567890 1234]5$67890 1234567890"); data.Document.UpdateFoldSegments(GetFoldSegments(data.Document), false); CaretMoveActions.Left(data); Assert.AreEqual(new DocumentLocation(4, 6), data.Caret.Location); CaretMoveActions.Left(data); Assert.AreEqual(new DocumentLocation(3, 5), data.Caret.Location); }
public void TestUpdateFoldSegmentBug() { var data = CaretMoveActionTests.Create( @"-[0 1 +[2 3 4 5 6 7 8 9 10] 11 ]12 13 +[14 15 16 17 18 19 20 21 22] 23 24 25 26"); var segments = GetFoldSegments(data.Document); data.Document.UpdateFoldSegments(segments, false); Assert.AreEqual(25, data.VisualToLogicalLine(9)); Assert.AreEqual(3, data.Document.FoldSegments.Count()); segments.RemoveAt(1); data.Document.UpdateFoldSegments(segments, false); Assert.AreEqual(2, data.Document.FoldSegments.Count()); Assert.AreEqual(17, data.LogicalToVisualLine(25)); segments.RemoveAt(1); data.Document.UpdateFoldSegments(segments, false); Assert.AreEqual(1, data.Document.FoldSegments.Count()); Assert.AreEqual(25, data.LogicalToVisualLine(25)); }
public void TestCaretUpCase2() { var data = CaretMoveActionTests.Create( @"AAAAAAAA AAAAAAAA AA+[AAAAAABBBBBBB AAAAAAAABBBBBBBBBB AAAAAAAABBBBBBBBBB AAAAAAAABBBBBBBBBB AAAAAAAABBBBBBBBBB] AAAAAAAA$ "); data.Document.UpdateFoldSegments(GetFoldSegments(data.Document), false); Assert.AreEqual(new DocumentLocation(8, 9), data.Caret.Location); CaretMoveActions.Up(data); Assert.AreEqual(true, data.Document.FoldSegments.First().IsFolded); Assert.AreEqual(new DocumentLocation(3, 3), data.Caret.Location); }
public void TestBug682466() { var data = CaretMoveActionTests.Create( @"0 1 2 +[3 4 5 6] 7 8 9 10"); var segments = GetFoldSegments(data.Document); data.Document.UpdateFoldSegments(segments, false); Assert.AreEqual(true, data.Document.FoldSegments.FirstOrDefault().IsFolded); segments = GetFoldSegments(data.Document); segments[0].IsFolded = false; data.Document.UpdateFoldSegments(segments, false); Assert.AreEqual(5, data.LogicalToVisualLine(8)); }