public void TestGetStartFoldingsGetStartFoldings() { Document document = new Mono.TextEditor.Document(); document.Text = @"+[1 2 3 +[4 5 +[6 7] 8] +[9 10 11] 12] +[13 14] 15 16"; var segments = GetFoldSegments(document); document.UpdateFoldSegments(segments, false); document.UpdateFoldSegments(segments, false); document.UpdateFoldSegments(segments, false); Assert.AreEqual(1, document.GetStartFoldings(1).Count()); Assert.AreEqual(1, document.GetStartFoldings(4).Count()); Assert.AreEqual(1, document.GetStartFoldings(6).Count()); Assert.AreEqual(1, document.GetStartFoldings(9).Count()); Assert.AreEqual(1, document.GetStartFoldings(13).Count()); }
public void TestBug682466() { Document document = new Mono.TextEditor.Document(); document.Text = @"0 1 2 +[3 4 5 6] 7 8 9 10"; var segments = GetFoldSegments(document); document.UpdateFoldSegments(segments, false); Assert.AreEqual(true, document.FoldSegments.FirstOrDefault().IsFolded); segments = GetFoldSegments(document); segments[0].IsFolded = false; document.UpdateFoldSegments(segments, false); Assert.AreEqual(5, document.LogicalToVisualLine(8)); }
public void TestUpdateFoldSegmentBug() { Document document = new Mono.TextEditor.Document(); document.Text = @"-[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(document); document.UpdateFoldSegments(segments, false); Assert.AreEqual(25, document.VisualToLogicalLine(9)); Assert.AreEqual(3, document.FoldSegments.Count()); segments.RemoveAt(1); document.UpdateFoldSegments(segments, false); Assert.AreEqual(2, document.FoldSegments.Count()); Assert.AreEqual(17, document.LogicalToVisualLine(25)); segments.RemoveAt(1); document.UpdateFoldSegments(segments, false); Assert.AreEqual(1, document.FoldSegments.Count()); Assert.AreEqual(25, document.LogicalToVisualLine(25)); }
public void TestUpdateFoldSegmentBug2() { Document document = new Mono.TextEditor.Document(); document.Text = @"-[1 2 +[3 4] 5 +[6 7] 8 9 10 11 12 13 14] 15 16"; var segments = GetFoldSegments(document); document.UpdateFoldSegments(segments, false); Assert.AreEqual(10, document.VisualToLogicalLine(8)); Assert.AreEqual(3, document.FoldSegments.Count()); int start = document.GetLine(2).Offset; int end = document.GetLine(8).Offset; ((IBuffer)document).Remove(start, end - start); Assert.AreEqual(1, document.FoldSegments.Count()); Assert.AreEqual(10, document.LogicalToVisualLine(10)); }
public void TestVisualToLogicalLine() { Document document = new Mono.TextEditor.Document(); document.Text = @"-[0 +[1 2 ]3 4 +[5 +[6 +[7 8 ]9 ]10 ]11 ]12 13 +[14 15 ]16 17"; document.UpdateFoldSegments(GetFoldSegments(document), false); Assert.AreEqual(4, document.LogicalToVisualLine(12)); Assert.AreEqual(6, document.LogicalToVisualLine(16)); Assert.AreEqual(7, document.LogicalToVisualLine(17)); }
public void TestIsFoldedUnsetFolded() { Document document = new Mono.TextEditor.Document(); document.Text = @"-[1 2 3 +[4 5 +[6 7] 8] -[9 10 11] 12] -[13 14] 15 16"; var segments = GetFoldSegments(document); document.UpdateFoldSegments(segments, false); Assert.AreEqual(11, document.LogicalToVisualLine(15)); document.GetStartFoldings(6).First().IsFolded = false; document.GetStartFoldings(4).First().IsFolded = false; Assert.AreEqual(15, document.LogicalToVisualLine(15)); }
public void TestUpdateFoldSegmentBug2() { Document document = new Mono.TextEditor.Document(); document.Text = @"-[0 1 +[2 3] 4 +[5 6] 7 8 9 10 11 12 13] 14 15"; var segments = GetFoldSegments(document); document.UpdateFoldSegments(segments, false); Assert.AreEqual(10, document.VisualToLogicalLine(8)); int start = document.GetLine(2).Offset; int end = document.GetLine(8).Offset; ((IBuffer)document).Remove(start, end - start); Assert.AreEqual(10, document.LogicalToVisualLine(10)); }
public void TestLogicalToVisualLine() { Document document = new Mono.TextEditor.Document(); document.Text = @"-[1 +[2 3 ]4 5 +[6 +[7 +[8 9 ]10 ]11 ]12 ]13 14 +[15 16 ]17 18"; document.UpdateFoldSegments(GetFoldSegments(document), false); Assert.AreEqual(4, document.LogicalToVisualLine(12)); Assert.AreEqual(6, document.LogicalToVisualLine(16)); Assert.AreEqual(7, document.LogicalToVisualLine(17)); }
public void TestVisualToLogicalLineCase2() { Document document = new Mono.TextEditor.Document(); document.Text = @"-[1 +[2 3 ]4 5 +[6 +[7 +[8 9 ]10 ]11 ]12 ]13 14 +[15 16 ]17 18"; document.UpdateFoldSegments(GetFoldSegments(document), false); Assert.AreEqual(6, document.VisualToLogicalLine(4)); Assert.AreEqual(14, document.VisualToLogicalLine(6)); Assert.AreEqual(15, document.VisualToLogicalLine(7)); }
public void TestVisualToLogicalLineStartLine() { Document document = new Mono.TextEditor.Document(); document.Text = @"-[1 -[2 3 ]4 5 -[6 +[7 -[8 9 ]10 ]11 ]12 ]13 14 -[15 16 ]17 18"; document.UpdateFoldSegments(GetFoldSegments(document), false); Assert.AreEqual(7, document.VisualToLogicalLine(7)); }
public void TestVisualToLogicalLine() { Document document = new Mono.TextEditor.Document(); document.Text = @"-[0 +[1 2 ]3 4 +[5 +[6 +[7 8 ]9 ]10 ]11 ]12 13 +[14 15 ]16 17"; document.UpdateFoldSegments(GetFoldSegments(document)); do { Gtk.Application.RunIteration(); } while (!document.HasFoldSegments); Assert.AreEqual(4, document.LogicalToVisualLine(12)); Assert.AreEqual(6, document.LogicalToVisualLine(16)); Assert.AreEqual(7, document.LogicalToVisualLine(17)); }
public void TestBug682466 () { Document document = new Mono.TextEditor.Document (); document.Text = @"0 1 2 +[3 4 5 6] 7 8 9 10"; var segments = GetFoldSegments (document); document.UpdateFoldSegments (segments, false); Assert.AreEqual (true, document.FoldSegments.FirstOrDefault ().IsFolded); segments = GetFoldSegments (document); segments[0].IsFolded = false; document.UpdateFoldSegments (segments, false); Assert.AreEqual (5, document.LogicalToVisualLine (8)); }
public void TestUpdateFoldSegmentBug () { Document document = new Mono.TextEditor.Document (); document.Text = @"-[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 (document); document.UpdateFoldSegments (segments, false); Assert.AreEqual (25, document.VisualToLogicalLine (9)); segments.RemoveAt (1); document.UpdateFoldSegments (segments, false); Assert.AreEqual (17, document.LogicalToVisualLine (25)); segments.RemoveAt (1); document.UpdateFoldSegments (segments, false); Assert.AreEqual (25, document.LogicalToVisualLine (25)); }
public void TestGetStartFoldingsGetStartFoldings () { Document document = new Mono.TextEditor.Document (); document.Text = @"+[1 2 3 +[4 5 +[6 7] 8] +[9 10 11] 12] +[13 14] 15 16"; var segments = GetFoldSegments (document); document.UpdateFoldSegments (segments, false); document.UpdateFoldSegments (segments, false); document.UpdateFoldSegments (segments, false); Assert.AreEqual (1, document.GetStartFoldings (1).Count ()); Assert.AreEqual (1, document.GetStartFoldings (4).Count ()); Assert.AreEqual (1, document.GetStartFoldings (6).Count ()); Assert.AreEqual (1, document.GetStartFoldings (9).Count ()); Assert.AreEqual (1, document.GetStartFoldings (13).Count ()); }
public void TestIsFoldedUnsetFolded () { Document document = new Mono.TextEditor.Document (); document.Text = @"-[1 2 3 +[4 5 +[6 7] 8] -[9 10 11] 12] -[13 14] 15 16"; var segments = GetFoldSegments (document); document.UpdateFoldSegments (segments, false); Assert.AreEqual (11, document.LogicalToVisualLine (15)); document.GetStartFoldings (6).First ().IsFolded = false; document.GetStartFoldings (4).First ().IsFolded = false; Assert.AreEqual (15, document.LogicalToVisualLine (15)); }
public void TestUpdateFoldSegmentBug2 () { Document document = new Mono.TextEditor.Document (); document.Text = @"-[1 2 +[3 4] 5 +[6 7] 8 9 10 11 12 13 14] 15 16"; var segments = GetFoldSegments (document); document.UpdateFoldSegments (segments, false); Assert.AreEqual (10, document.VisualToLogicalLine (8)); Assert.AreEqual (3, document.FoldSegments.Count ()); int start = document.GetLine (2).Offset; int end = document.GetLine (8).Offset; ((IBuffer)document).Remove (start, end - start); Assert.AreEqual (1, document.FoldSegments.Count ()); Assert.AreEqual (10, document.LogicalToVisualLine (10)); }
public void TestUpdateFoldSegmentBug2 () { Document document = new Mono.TextEditor.Document (); document.Text = @"-[0 1 +[2 3] 4 +[5 6] 7 8 9 10 11 12 13] 14 15"; var segments = GetFoldSegments (document); document.UpdateFoldSegments (segments, false); Assert.AreEqual (10, document.VisualToLogicalLine (8)); int start = document.GetLine (2).Offset; int end = document.GetLine (8).Offset; ((IBuffer)document).Remove (start, end - start); Assert.AreEqual (10, document.LogicalToVisualLine (10)); }
public void TestVisualToLogicalLine () { Document document = new Mono.TextEditor.Document (); document.Text = @"-[0 +[1 2 ]3 4 +[5 +[6 +[7 8 ]9 ]10 ]11 ]12 13 +[14 15 ]16 17"; document.UpdateFoldSegments (GetFoldSegments (document)); do { Gtk.Application.RunIteration (); } while (!document.HasFoldSegments); Assert.AreEqual (4, document.LogicalToVisualLine (12)); Assert.AreEqual (6, document.LogicalToVisualLine (16)); Assert.AreEqual (7, document.LogicalToVisualLine (17)); }
public void TestLogicalToVisualLineStartLine () { Document document = new Mono.TextEditor.Document (); document.Text = @"-[1 -[2 3 ]4 5 -[6 +[7 -[8 9 ]10 ]11 ]12 ]13 14 -[15 16 ]17 18"; document.UpdateFoldSegments (GetFoldSegments (document), false); Assert.AreEqual (7, document.LogicalToVisualLine (7)); }
public void TestLogicalToVisualLine () { Document document = new Mono.TextEditor.Document (); document.Text = @"-[1 +[2 3 ]4 5 +[6 +[7 +[8 9 ]10 ]11 ]12 ]13 14 +[15 16 ]17 18"; document.UpdateFoldSegments (GetFoldSegments (document), false); Assert.AreEqual (4, document.LogicalToVisualLine (12)); Assert.AreEqual (6, document.LogicalToVisualLine (16)); Assert.AreEqual (7, document.LogicalToVisualLine (17)); }
public void TestVisualToLogicalLine () { Document document = new Mono.TextEditor.Document (); document.Text = @"-[0 +[1 2 ]3 4 +[5 +[6 +[7 8 ]9 ]10 ]11 ]12 13 +[14 15 ]16 17"; document.UpdateFoldSegments (GetFoldSegments (document), false); Assert.AreEqual (4, document.LogicalToVisualLine (12)); Assert.AreEqual (6, document.LogicalToVisualLine (16)); Assert.AreEqual (7, document.LogicalToVisualLine (17)); }
public void TestVisualToLogicalLineCase2 () { Document document = new Mono.TextEditor.Document (); document.Text = @"-[1 +[2 3 ]4 5 +[6 +[7 +[8 9 ]10 ]11 ]12 ]13 14 +[15 16 ]17 18"; document.UpdateFoldSegments (GetFoldSegments (document), false); Assert.AreEqual (6, document.VisualToLogicalLine (4)); Assert.AreEqual (14, document.VisualToLogicalLine (6)); Assert.AreEqual (15, document.VisualToLogicalLine (7)); }