コード例 #1
0
		public void TestLastLineRemove ()
		{
			IBuffer buffer = new Mono.TextEditor.GapBuffer ();
			LineSplitter splitter = new Mono.TextEditor.LineSplitter (buffer);
			buffer.Text = "1\n2\n3\n";
			splitter.TextReplaced (null, new ReplaceEventArgs (0, 0, buffer.Text));
			
			LineSegment lastLine = splitter.Get (2);
			splitter.TextReplaced (null, new ReplaceEventArgs (lastLine.Offset, lastLine.Length, ""));
			
			Assert.AreEqual (3, splitter.LineCount);
			
			Assert.AreEqual (2 * 2, splitter.Get (2).Offset);
			Assert.AreEqual (0, splitter.Get (2).EditableLength);
			Assert.AreEqual (0, splitter.Get (2).DelimiterLength);
			Assert.AreEqual (0, splitter.Get (2).Length);
		}
コード例 #2
0
ファイル: LineSplitterTests.cs プロジェクト: txdv/monodevelop
		public void TestLastLineRemove ()
		{
			IBuffer buffer = new Mono.TextEditor.GapBuffer ();
			LineSplitter splitter = new Mono.TextEditor.LineSplitter ();
			buffer.Text = "1\n2\n3\n";
			splitter.TextReplaced (null, new DocumentChangeEventArgs (0, "", buffer.Text));
			
			LineSegment lastLine = splitter.Get (2);
			splitter.TextReplaced (null, new DocumentChangeEventArgs (lastLine.Offset, buffer.GetTextAt (lastLine.Offset, lastLine.LengthIncludingDelimiter), ""));
			
			Assert.AreEqual (3, splitter.Count);
			
			Assert.AreEqual (2 * 2, splitter.Get (3).Offset);
			Assert.AreEqual (0, splitter.Get (3).Length);
			Assert.AreEqual (0, splitter.Get (3).DelimiterLength);
			Assert.AreEqual (0, splitter.Get (3).LengthIncludingDelimiter);
		}
コード例 #3
0
		public void TestLastLineRemove ()
		{
			var buffer = ImmutableText.Empty;
			LineSplitter splitter = new Mono.TextEditor.LineSplitter ();
			buffer = buffer.InsertText (0, "1\n2\n3\n");
			splitter.TextReplaced (null, new DocumentChangeEventArgs (0, "", buffer.ToString ()));
			
			DocumentLine lastLine = splitter.Get (2);
			splitter.TextReplaced (null, new DocumentChangeEventArgs (lastLine.Offset, buffer.ToString (lastLine.Offset, lastLine.LengthIncludingDelimiter), ""));
			
			Assert.AreEqual (3, splitter.Count);
			
			Assert.AreEqual (2 * 2, splitter.Get (3).Offset);
			Assert.AreEqual (0, splitter.Get (3).Length);
			Assert.AreEqual (0, splitter.Get (3).DelimiterLength);
			Assert.AreEqual (0, splitter.Get (3).LengthIncludingDelimiter);
		}
コード例 #4
0
        public void TestLastLineRemove()
        {
            var          buffer   = ImmutableText.Empty;
            LineSplitter splitter = new Mono.TextEditor.LineSplitter();

            buffer = buffer.InsertText(0, "1\n2\n3\n");
            splitter.TextReplaced(null, new DocumentChangeEventArgs(0, "", buffer.ToString()));

            DocumentLine lastLine = splitter.Get(2);

            splitter.TextReplaced(null, new DocumentChangeEventArgs(lastLine.Offset, buffer.ToString(lastLine.Offset, lastLine.LengthIncludingDelimiter), ""));

            Assert.AreEqual(3, splitter.Count);

            Assert.AreEqual(2 * 2, splitter.Get(3).Offset);
            Assert.AreEqual(0, splitter.Get(3).Length);
            Assert.AreEqual(0, splitter.Get(3).DelimiterLength);
            Assert.AreEqual(0, splitter.Get(3).LengthIncludingDelimiter);
        }
コード例 #5
0
        public void TestLastLineRemove()
        {
            IBuffer      buffer   = new Mono.TextEditor.GapBuffer();
            LineSplitter splitter = new Mono.TextEditor.LineSplitter();

            buffer.Text = "1\n2\n3\n";
            splitter.TextReplaced(null, new ReplaceEventArgs(0, 0, buffer.Text));

            LineSegment lastLine = splitter.Get(2);

            splitter.TextReplaced(null, new ReplaceEventArgs(lastLine.Offset, lastLine.Length, ""));

            Assert.AreEqual(3, splitter.Count);

            Assert.AreEqual(2 * 2, splitter.Get(3).Offset);
            Assert.AreEqual(0, splitter.Get(3).EditableLength);
            Assert.AreEqual(0, splitter.Get(3).DelimiterLength);
            Assert.AreEqual(0, splitter.Get(3).Length);
        }
コード例 #6
0
        public void TestLastLineRemove()
        {
            IBuffer      buffer   = new Mono.TextEditor.GapBuffer();
            LineSplitter splitter = new Mono.TextEditor.LineSplitter();

            buffer.Text = "1\n2\n3\n";
            splitter.TextReplaced(null, new DocumentChangeEventArgs(0, "", buffer.Text));

            DocumentLine lastLine = splitter.Get(2);

            splitter.TextReplaced(null, new DocumentChangeEventArgs(lastLine.Offset, buffer.GetTextAt(lastLine.Offset, lastLine.LengthIncludingDelimiter), ""));

            Assert.AreEqual(3, splitter.Count);

            Assert.AreEqual(2 * 2, splitter.Get(3).Offset);
            Assert.AreEqual(0, splitter.Get(3).Length);
            Assert.AreEqual(0, splitter.Get(3).DelimiterLength);
            Assert.AreEqual(0, splitter.Get(3).LengthIncludingDelimiter);
        }
コード例 #7
0
ファイル: LineSplitterTests.cs プロジェクト: txdv/monodevelop
		public void TestLastLineCreation ()
		{
			IBuffer buffer = new Mono.TextEditor.GapBuffer ();
			LineSplitter splitter = new Mono.TextEditor.LineSplitter ();
			buffer.Text = "1\n2\n3\n";
			splitter.TextReplaced (null, new DocumentChangeEventArgs (0, "", buffer.Text));
			Assert.AreEqual (4, splitter.Count);
			for (int i = 0; i < 3; i++) {
				Assert.AreEqual (i * 2, splitter.Get (i + 1).Offset);
				Assert.AreEqual (1, splitter.Get (i + 1).Length);
				Assert.AreEqual (1, splitter.Get (i + 1).DelimiterLength);
				Assert.AreEqual (2, splitter.Get (i + 1).LengthIncludingDelimiter);
			}
			Assert.AreEqual (3 * 2, splitter.Get (4).Offset);
			Assert.AreEqual (0, splitter.Get (4).Length);
			Assert.AreEqual (0, splitter.Get (4).DelimiterLength);
			Assert.AreEqual (0, splitter.Get (4).LengthIncludingDelimiter);
		}
コード例 #8
0
		public void TestLastLineCreation ()
		{
			IBuffer buffer = new Mono.TextEditor.GapBuffer ();
			LineSplitter splitter = new Mono.TextEditor.LineSplitter (buffer);
			buffer.Text = "1\n2\n3\n";
			splitter.TextReplaced (null, new ReplaceEventArgs (0, 0, buffer.Text));
			Assert.AreEqual (4, splitter.LineCount);
			for (int i = 0; i < 3; i++) {
				Assert.AreEqual (i * 2, splitter.Get (i).Offset);
				Assert.AreEqual (1, splitter.Get (i).EditableLength);
				Assert.AreEqual (1, splitter.Get (i).DelimiterLength);
				Assert.AreEqual (2, splitter.Get (i).Length);
			}
			Assert.AreEqual (3 * 2, splitter.Get (3).Offset);
			Assert.AreEqual (0, splitter.Get (3).EditableLength);
			Assert.AreEqual (0, splitter.Get (3).DelimiterLength);
			Assert.AreEqual (0, splitter.Get (3).Length);
		}
コード例 #9
0
		public void TestLastLineCreation ()
		{
			var buffer = ImmutableText.Empty;
			LineSplitter splitter = new Mono.TextEditor.LineSplitter ();
			buffer = buffer.InsertText (0, "1\n2\n3\n");
			splitter.TextReplaced (null, new DocumentChangeEventArgs (0, "", buffer.ToString ()));
			Assert.AreEqual (4, splitter.Count);
			for (int i = 0; i < 3; i++) {
				Assert.AreEqual (i * 2, splitter.Get (i + 1).Offset);
				Assert.AreEqual (1, splitter.Get (i + 1).Length);
				Assert.AreEqual (1, splitter.Get (i + 1).DelimiterLength);
				Assert.AreEqual (2, splitter.Get (i + 1).LengthIncludingDelimiter);
			}
			Assert.AreEqual (3 * 2, splitter.Get (4).Offset);
			Assert.AreEqual (0, splitter.Get (4).Length);
			Assert.AreEqual (0, splitter.Get (4).DelimiterLength);
			Assert.AreEqual (0, splitter.Get (4).LengthIncludingDelimiter);
		}
コード例 #10
0
        public void TestLastLineCreation()
        {
            var          buffer   = ImmutableText.Empty;
            LineSplitter splitter = new Mono.TextEditor.LineSplitter();

            buffer = buffer.InsertText(0, "1\n2\n3\n");
            splitter.TextReplaced(null, new DocumentChangeEventArgs(0, "", buffer.ToString()));
            Assert.AreEqual(4, splitter.Count);
            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(i * 2, splitter.Get(i + 1).Offset);
                Assert.AreEqual(1, splitter.Get(i + 1).Length);
                Assert.AreEqual(1, splitter.Get(i + 1).DelimiterLength);
                Assert.AreEqual(2, splitter.Get(i + 1).LengthIncludingDelimiter);
            }
            Assert.AreEqual(3 * 2, splitter.Get(4).Offset);
            Assert.AreEqual(0, splitter.Get(4).Length);
            Assert.AreEqual(0, splitter.Get(4).DelimiterLength);
            Assert.AreEqual(0, splitter.Get(4).LengthIncludingDelimiter);
        }
コード例 #11
0
        public void TestLastLineCreation()
        {
            IBuffer      buffer   = new Mono.TextEditor.GapBuffer();
            LineSplitter splitter = new Mono.TextEditor.LineSplitter();

            buffer.Text = "1\n2\n3\n";
            splitter.TextReplaced(null, new ReplaceEventArgs(0, 0, buffer.Text));
            Assert.AreEqual(4, splitter.Count);
            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(i * 2, splitter.Get(i + 1).Offset);
                Assert.AreEqual(1, splitter.Get(i + 1).EditableLength);
                Assert.AreEqual(1, splitter.Get(i + 1).DelimiterLength);
                Assert.AreEqual(2, splitter.Get(i + 1).Length);
            }
            Assert.AreEqual(3 * 2, splitter.Get(4).Offset);
            Assert.AreEqual(0, splitter.Get(4).EditableLength);
            Assert.AreEqual(0, splitter.Get(4).DelimiterLength);
            Assert.AreEqual(0, splitter.Get(4).Length);
        }