Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        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));
        }
Ejemplo n.º 9
0
        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));
        }
Ejemplo n.º 10
0
		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));
		}
Ejemplo n.º 11
0
		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));
		}
Ejemplo n.º 12
0
		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));
		}
Ejemplo n.º 13
0
		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));
		}
Ejemplo n.º 14
0
		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));
		}
Ejemplo n.º 15
0
		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));
		}
Ejemplo n.º 16
0
		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));
		}
Ejemplo n.º 17
0
		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));
		}
Ejemplo n.º 18
0
		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));
		}