~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/UnitTests/Mono.TextEditor.Tests.DefaultEditActions/DeleteActionTests.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// 
2
 
// DeleteActionTests.cs
3
 
//  
4
 
// Author:
5
 
//       Mike Krüger <mkrueger@novell.com>
6
 
// 
7
 
// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
8
 
// 
9
 
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
 
// of this software and associated documentation files (the "Software"), to deal
11
 
// in the Software without restriction, including without limitation the rights
12
 
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
 
// copies of the Software, and to permit persons to whom the Software is
14
 
// furnished to do so, subject to the following conditions:
15
 
// 
16
 
// The above copyright notice and this permission notice shall be included in
17
 
// all copies or substantial portions of the Software.
18
 
// 
19
 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
 
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
 
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
 
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
 
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
 
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
 
// THE SOFTWARE.
26
 
 
27
 
using System;
28
 
using NUnit.Framework;
29
 
 
30
 
namespace Mono.TextEditor.Tests.Actions
31
 
{
32
 
        [TestFixture()]
33
 
        public class DeleteActionTests : TextEditorTestBase
34
 
        {
35
 
                [Test()]
36
 
                public void TestBackspace ()
37
 
                {
38
 
                        var data = Create (@"1234$567890");
39
 
                        DeleteActions.Backspace (data);
40
 
                        Check (data, @"123$567890");
41
 
                }
42
 
                
43
 
                [Test()]
44
 
                public void TestBackspaceCase1 ()
45
 
                {
46
 
                        var data = Create (@"$1234567890");
47
 
                        DeleteActions.Backspace (data);
48
 
                        Check (data, @"$1234567890");
49
 
                }
50
 
                
51
 
                [Test()]
52
 
                public void TestDelete ()
53
 
                {
54
 
                        var data = Create (@"1234$567890");
55
 
                        DeleteActions.Delete (data);
56
 
                        Check (data, @"1234$67890");
57
 
                }
58
 
                
59
 
                [Test()]
60
 
                public void TestBackspaceDeleteCase1 ()
61
 
                {
62
 
                        var data = Create (@"1234567890$");
63
 
                        DeleteActions.Delete (data);
64
 
                        Check (data, @"1234567890$");
65
 
                }
66
 
                
67
 
                [Test()]
68
 
                public void TestDeleteCaretLine ()
69
 
                {
70
 
                        var data = Create (@"1234567890
71
 
1234$67890
72
 
1234567890");
73
 
                        DeleteActions.CaretLine (data);
74
 
                        Assert.AreEqual (@"1234567890
75
 
1234567890", data.Document.Text);
76
 
                }
77
 
 
78
 
                [Test()]
79
 
                public void TestDeleteCaretLineWithFoldings ()
80
 
                {
81
 
                        var data = Create (@"1234567890
82
 
1234$678+[90
83
 
1234567890
84
 
123456789]0
85
 
1234567890");
86
 
                        DeleteActions.CaretLine (data);
87
 
                        Assert.AreEqual (@"1234567890
88
 
1234567890", data.Document.Text);
89
 
                }
90
 
                
91
 
                [Test()]
92
 
                public void TestDeleteCaretLineWithFoldingsCase2 ()
93
 
                {
94
 
                        var data = Create (@"1234567890
95
 
12+[3467890
96
 
12]34$567+[890
97
 
123456789]0
98
 
1234567890");
99
 
                        DeleteActions.CaretLine (data);
100
 
                        Assert.AreEqual (@"1234567890
101
 
1234567890", data.Document.Text);
102
 
                }
103
 
                
104
 
 
105
 
                [Test()]
106
 
                public void TestDeleteCaretLineToEnd ()
107
 
                {
108
 
                        var data = Create (@"1234567890
109
 
1234$67890
110
 
1234567890");
111
 
                        DeleteActions.CaretLineToEnd (data);
112
 
                        Assert.AreEqual (@"1234567890
113
 
1234
114
 
1234567890", data.Document.Text);
115
 
                }
116
 
 
117
 
                [Test()]
118
 
                public void TestDeleteCaretLineToEndWithFoldings ()
119
 
                {
120
 
                        var data = Create (@"1234567890
121
 
1234$678+[90
122
 
1234567890
123
 
123456789]0
124
 
1234567890");
125
 
                        DeleteActions.CaretLineToEnd (data);
126
 
                        Assert.AreEqual (@"1234567890
127
 
1234
128
 
1234567890", data.Document.Text);
129
 
                }
130
 
 
131
 
 
132
 
 
133
 
                [Test()]
134
 
                public void TestDeletePreviousWord ()
135
 
                {
136
 
                        var data = Create (@"      word1 word2 word3$");
137
 
                        DeleteActions.PreviousWord (data);
138
 
                        Check (data, @"      word1 word2 $");
139
 
                        DeleteActions.PreviousWord (data);
140
 
                        Check (data, @"      word1 $");
141
 
                        DeleteActions.PreviousWord (data);
142
 
                        Check (data, @"      $");
143
 
                }
144
 
                
145
 
                [Test()]
146
 
                public void TestDeletePreviousSubword ()
147
 
                {
148
 
                        var data = Create (@"      SomeLongWord$");
149
 
                        DeleteActions.PreviousSubword (data);
150
 
                        Check (data, @"      SomeLong$");
151
 
                        DeleteActions.PreviousSubword (data);
152
 
                        Check (data, @"      Some$");
153
 
                        DeleteActions.PreviousSubword (data);
154
 
                        Check (data, @"      $");
155
 
                }
156
 
 
157
 
                [Test()]
158
 
                public void TestDeleteNextWord ()
159
 
                {
160
 
                        var data = Create (@"      $word1 word2 word3");
161
 
                        DeleteActions.NextWord (data);
162
 
                        Check (data, @"      $ word2 word3");
163
 
                        DeleteActions.NextWord (data);
164
 
                        Check (data, @"      $ word3");
165
 
                        DeleteActions.NextWord (data);
166
 
                        Check (data, @"      $");
167
 
                }
168
 
 
169
 
                [Test()]
170
 
                public void TestDeleteNextSubword ()
171
 
                {
172
 
                        var data = Create (@"      $SomeLongWord");
173
 
                        DeleteActions.NextSubword (data);
174
 
                        Check (data, @"      $LongWord");
175
 
                        DeleteActions.NextSubword (data);
176
 
                        Check (data, @"      $Word");
177
 
                        DeleteActions.NextSubword (data);
178
 
                        Check (data, @"      $");
179
 
                }
180
 
        }
181
 
}