Author: mkrueger
Date: 2008-02-19 10:19:37 -0500 (Tue, 19 Feb 2008)
New Revision: 96153

Added:
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/RemoveTabTests.cs
Modified:
   trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/InsertTabTests.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.mdp
Log:
* 
Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/InsertTabTests.cs,
  
Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/RemoveTabTests.cs:
  Added Remove tab tests.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-19 
15:17:31 UTC (rev 96152)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-19 
15:19:37 UTC (rev 96153)
@@ -1,5 +1,11 @@
 2008-02-19  Mike Krüger <[EMAIL PROTECTED]> 
 
+       * 
Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/InsertTabTests.cs,
+         
Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/RemoveTabTests.cs:
+         Added Remove tab tests.
+
+2008-02-19  Mike Krüger <[EMAIL PROTECTED]> 
+
        * Mono.TextEditor/DefaultEditActions.cs, 
Mono.TextEditor/TextViewMargin.cs,
          Mono.TextEditor/TextEditorData.cs, Mono.TextEditor/TextEditor.cs: 
Fixed
          little issues found by unit testing.

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/InsertTabTests.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/InsertTabTests.cs
  2008-02-19 15:17:31 UTC (rev 96152)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/InsertTabTests.cs
  2008-02-19 15:19:37 UTC (rev 96153)
@@ -34,14 +34,14 @@
        public class InsertTabTests
        {
                
-               static ISegment GetSelection (TextEditorData data, bool reverse)
+               public static ISegment GetSelection (TextEditorData data, bool 
reverse)
                {
                        int offset1 = data.Document.Text.IndexOf ('[');
                        int offset2 = data.Document.Text.IndexOf (']');
                        return new Segment (offset1, offset2 - offset1);
                }
 
-               static void SetSelection (TextEditorData data, bool reverse)
+               public static void SetSelection (TextEditorData data, bool 
reverse)
                {
                        ISegment selection = GetSelection (data, reverse);
                        

Added: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/RemoveTabTests.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/RemoveTabTests.cs
  2008-02-19 15:17:31 UTC (rev 96152)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/RemoveTabTests.cs
  2008-02-19 15:19:37 UTC (rev 96153)
@@ -0,0 +1,175 @@
+//
+// RemoveTabTests.cs
+//
+// Author:
+//   Mike Krüger <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using NUnit.Framework;
+
+namespace Mono.TextEditor.Tests
+{
+       [TestFixture()]
+       public class RemoveTabTests
+       {
+               [Test()]
+               public void TestRemoveTab ()
+               {
+                       TextEditorData data = new 
Mono.TextEditor.TextEditorData  ();
+                       data.Document.Text = 
+@"\t123456789
+\t123[456789
+\t123d456789
+\t123]456789
+\t123456789
+\t123456789";
+                       InsertTabTests.SetSelection (data, false);
+                       
+                       new RemoveTab ().Run (data);
+                       ISegment currentSelection = InsertTabTests.GetSelection 
(data, false);
+                       
+                       Assert.AreEqual (currentSelection.Offset, 
data.SelectionRange.Offset);
+                       Assert.AreEqual (currentSelection.EndOffset, 
data.SelectionRange.EndOffset);
+                       Assert.AreEqual (currentSelection.EndOffset, 
data.Caret.Offset);
+                       Assert.AreEqual (currentSelection.Offset, 
data.SelectionAnchor);
+                       
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(1).Length);
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(2).Length);
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(3).Length);
+                       
+                       Assert.AreEqual (data.Document.GetLine(0).Length, 
data.Document.GetLine(4).Length);
+                       
+                       Assert.AreEqual (data.Document.GetLine(1).Length, 
data.Document.GetLine(2).Length);
+                       Assert.AreEqual (data.Document.GetLine(1).Length, 
data.Document.GetLine(3).Length);
+               }
+               
+               [Test()]
+               public void TestRemoveTabReverse ()
+               {
+                       TextEditorData data = new 
Mono.TextEditor.TextEditorData  ();
+                       data.Document.Text = 
+@"\t123456789
+\t123[456789
+\t123d456789
+\t123]456789
+\t123456789
+\t123456789";
+                       InsertTabTests.SetSelection (data, true);
+                       
+                       new RemoveTab ().Run (data);
+                       ISegment currentSelection = InsertTabTests.GetSelection 
(data, true);
+                       
+                       Assert.AreEqual (currentSelection.Offset, 
data.SelectionRange.Offset);
+                       Assert.AreEqual (currentSelection.EndOffset, 
data.SelectionRange.EndOffset);
+                       Assert.AreEqual (currentSelection.Offset, 
data.Caret.Offset);
+                       Assert.AreEqual (currentSelection.EndOffset, 
data.SelectionAnchor);
+                       
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(1).Length);
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(2).Length);
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(3).Length);
+                       
+                       Assert.AreEqual (data.Document.GetLine(0).Length, 
data.Document.GetLine(4).Length);
+                       
+                       Assert.AreEqual (data.Document.GetLine(1).Length, 
data.Document.GetLine(2).Length);
+                       Assert.AreEqual (data.Document.GetLine(1).Length, 
data.Document.GetLine(3).Length);
+               }
+               
+               [Test()]
+               public void TestRemoveTabCase2 ()
+               {
+                       TextEditorData data = new 
Mono.TextEditor.TextEditorData  ();
+                       data.Document.Text = 
+@"\t123456789
+[\t123456789
+\t123d456789
+\t123]456789
+\t123456789
+\t123456789";
+                       InsertTabTests.SetSelection (data, false);
+                       
+                       new RemoveTab ().Run (data);
+                       ISegment currentSelection = InsertTabTests.GetSelection 
(data, false);
+                       
+                       Assert.AreEqual (currentSelection.Offset, 
data.SelectionRange.Offset);
+                       Assert.AreEqual (currentSelection.EndOffset, 
data.SelectionRange.EndOffset);
+                       Assert.AreEqual (currentSelection.EndOffset, 
data.Caret.Offset);
+                       Assert.AreEqual (currentSelection.Offset, 
data.SelectionAnchor);
+                       Assert.AreEqual (currentSelection.Offset, 
data.Document.GetLine(1).Offset);
+                       
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(1).Length);
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(2).Length);
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(3).Length);
+                       
+                       Assert.AreEqual (data.Document.GetLine(0).Length, 
data.Document.GetLine(4).Length);
+                       
+                       Assert.AreEqual (data.Document.GetLine(1).Length, 
data.Document.GetLine(2).Length);
+                       Assert.AreEqual (data.Document.GetLine(1).Length, 
data.Document.GetLine(3).Length);
+               }
+               
+               [Test()]
+               public void TestRemoveTabCase2Reverse ()
+               {
+                       TextEditorData data = new 
Mono.TextEditor.TextEditorData  ();
+                       data.Document.Text = 
+@"\t123456789
+[\t123456789
+\t123d456789
+\t123]456789
+\t123456789
+\t123456789";
+                       InsertTabTests.SetSelection (data, true);
+                       
+                       new RemoveTab ().Run (data);
+                       ISegment currentSelection = InsertTabTests.GetSelection 
(data, true);
+                       
+                       Assert.AreEqual (currentSelection.Offset, 
data.SelectionRange.Offset);
+                       Assert.AreEqual (currentSelection.EndOffset, 
data.SelectionRange.EndOffset);
+                       Assert.AreEqual (currentSelection.Offset, 
data.Caret.Offset);
+                       Assert.AreEqual (0, data.Caret.Column);
+                       Assert.AreEqual (currentSelection.EndOffset, 
data.SelectionAnchor);
+                       
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(1).Length);
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(2).Length);
+                       Assert.Less (data.Document.GetLine(0).Length, 
data.Document.GetLine(3).Length);
+                       
+                       Assert.AreEqual (data.Document.GetLine(0).Length, 
data.Document.GetLine(4).Length);
+                       
+                       Assert.AreEqual (data.Document.GetLine(1).Length, 
data.Document.GetLine(2).Length);
+                       Assert.AreEqual (data.Document.GetLine(1).Length, 
data.Document.GetLine(3).Length);
+               }
+               
+               [TestFixtureSetUp] 
+               public void SetUp()
+               {
+                       Gtk.Application.Init ();
+               }
+               
+               [TestFixtureTearDown] 
+               public void Dispose()
+               {
+               }
+       }
+}
+

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.mdp
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.mdp
   2008-02-19 15:17:31 UTC (rev 96152)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.mdp
   2008-02-19 15:19:37 UTC (rev 96153)
@@ -21,6 +21,7 @@
     <File name="Mono.TextEditor.Tests.DefaultEditActions/InsertTabTests.cs" 
subtype="Code" buildaction="Compile" />
     <File name="Mono.TextEditor.Tests/DocumentTests.cs" subtype="Code" 
buildaction="Compile" />
     <File name="Mono.TextEditor.Tests/SelectionTests.cs" subtype="Code" 
buildaction="Compile" />
+    <File name="Mono.TextEditor.Tests.DefaultEditActions/RemoveTabTests.cs" 
subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="True" refto="Mono.TextEditor" 
/>

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to