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

« back to all changes in this revision

Viewing changes to tests/UnitTests/Mono.TextEditor.Tests/BlockSelectionModeTests.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
 
// BlockSelectionModeTests.cs
3
 
//  
4
 
// Author:
5
 
//       Mike Krüger <mkrueger@xamarin.com>
6
 
// 
7
 
// Copyright (c) 2012 Xamarin Inc. (http://xamarin.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
 
using System;
27
 
using NUnit.Framework;
28
 
using System.Linq;
29
 
 
30
 
namespace Mono.TextEditor.Tests
31
 
{
32
 
        [TestFixture()]
33
 
        public class BlockSelectionModeTests : TextEditorTestBase
34
 
        {
35
 
                [Test]
36
 
                public void TestInsertAtCaret ()
37
 
                {
38
 
                        var data = Create (
39
 
@"1234567890
40
 
1234<-567890
41
 
1234567890
42
 
1234567890
43
 
1234->$567890
44
 
1234567890");
45
 
                        data.MainSelection.SelectionMode = SelectionMode.Block;
46
 
                        data.InsertAtCaret ("hello");
47
 
                        Console.WriteLine (data.Text);
48
 
                        Check (data, @"1234567890
49
 
1234hello<-567890
50
 
1234hello567890
51
 
1234hello567890
52
 
1234hello->$567890
53
 
1234567890");
54
 
 
55
 
                }
56
 
 
57
 
                [Test]
58
 
                public void TestEditModeInput ()
59
 
                {
60
 
                        var data = Create (
61
 
@"1234567890
62
 
1234<-567890
63
 
1234567890
64
 
1234567890
65
 
1234->$567890
66
 
1234567890");
67
 
                        data.MainSelection.SelectionMode = SelectionMode.Block;
68
 
                        data.CurrentMode = new SimpleEditMode ();
69
 
                        data.CurrentMode.InternalHandleKeypress (null, data, Gdk.Key.a, (uint)'a', Gdk.ModifierType.None);
70
 
                        Check (data, @"1234567890
71
 
1234a<-567890
72
 
1234a567890
73
 
1234a567890
74
 
1234a->$567890
75
 
1234567890");
76
 
 
77
 
                }
78
 
 
79
 
                [Test]
80
 
                public void TestBackspace ()
81
 
                {
82
 
                        var data = Create (
83
 
@"1234567890
84
 
1234<-567890
85
 
1234567890
86
 
1234567890
87
 
1234->$567890
88
 
1234567890");
89
 
                        data.MainSelection.SelectionMode = SelectionMode.Block;
90
 
                        DeleteActions.Backspace (data);
91
 
                        Check (data, @"1234567890
92
 
123<-567890
93
 
123567890
94
 
123567890
95
 
123->$567890
96
 
1234567890");
97
 
                }
98
 
 
99
 
                [Test]
100
 
                public void TestDelete ()
101
 
                {
102
 
                        var data = Create (
103
 
@"1234567890
104
 
1234<-567890
105
 
1234567890
106
 
1234567890
107
 
1234->$567890
108
 
1234567890");
109
 
                        data.MainSelection.SelectionMode = SelectionMode.Block;
110
 
                        DeleteActions.Delete (data);
111
 
                        Check (data, @"1234567890
112
 
1234<-67890
113
 
123467890
114
 
123467890
115
 
1234->$67890
116
 
1234567890");
117
 
                }
118
 
 
119
 
        }
120
 
}
121