~ubuntu-branches/ubuntu/wily/monodevelop/wily

« back to all changes in this revision

Viewing changes to tests/UnitTests/Mono.TextEditor.Tests/TextBreakerTests.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2012-05-27 18:08:20 UTC
  • mfrom: (19.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20120527180820-fydl21qnbnfr8w2t
Tags: 3.0.2+dfsg-3
* [fcecfe7] Fix monodevelop-core-addins.pc.in to point to actual 
  installed location of assemblies.
* [26e1a07] DebSrc 3.0 does not support Quilt's -p parameter, so 
  manually adjust the path in the patch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
using Mono.TextEditor;
29
29
using Mono.TextEditor.Utils;
30
30
using NUnit.Framework;
31
 
using NUnit.Framework.SyntaxHelpers;
32
31
using System.Collections.Generic;
33
32
 
34
33
namespace Mono.TextEditor.Tests
35
34
{
36
35
        [TestFixture()]
37
 
        public class TextBreakerTests
 
36
        public class TextBreakerTests : TextEditorTestBase
38
37
        {
39
38
                [Test()]
40
39
                public void TestTextBreakerWithSingleWord ()
41
40
                {
42
 
                        List<ISegment> segments = BreakAllLines ("Word");
 
41
                        var segments = BreakAllLines ("Word");
43
42
                        Assert.That (segments.Count, Is.EqualTo (1));
44
43
                        Assert.That (segments [0].Offset, Is.EqualTo (0));
45
44
                        Assert.That (segments [0].Length, Is.EqualTo (4));
48
47
                [Test()]
49
48
                public void TestTextBreakerWithSingleWordWrappedInSpaces ()
50
49
                {
51
 
                        List<ISegment> segments = BreakAllLines (" Word ");
 
50
                        var segments = BreakAllLines (" Word ");
52
51
                        Assert.That (segments.Count, Is.EqualTo (3));
53
52
                        Assert.That (segments [0].Offset, Is.EqualTo (0));
54
53
                        Assert.That (segments [0].Length, Is.EqualTo (1));
61
60
                [Test()]
62
61
                public void TestTextBreakerWithMultipleLines ()
63
62
                {
64
 
                        List<ISegment> segments = BreakAllLines ("SomeText\nTwo Words");
 
63
                        var segments = BreakAllLines ("SomeText\nTwo Words");
65
64
                        Assert.That (segments.Count, Is.EqualTo (4));
66
65
                        Assert.That (segments [0].Offset, Is.EqualTo (0));
67
66
                        Assert.That (segments [0].Length, Is.EqualTo (8));
76
75
                [Test()]
77
76
                public void Bug666274_CheckLeftHandSideWordBreaking ()
78
77
                {
79
 
                        List<ISegment> segments = BreakAllLines ("                      //Set points in panel");
 
78
                        var segments = BreakAllLines ("                 //Set points in panel");
80
79
                        Assert.That(segments.Count, Is.EqualTo(12));
81
80
                }
82
81
 
83
82
                [Test()]
84
83
                public void Bug666274_CheckRightHandSideWordBreaking ()
85
84
                {
86
 
                        List<ISegment> segments = BreakAllLines (@"                     if (WarFoundryCore.CurrentArmy != null)
 
85
                        var segments = BreakAllLines (@"                        if (WarFoundryCore.CurrentArmy != null)
87
86
                        {
88
87
                                lblTotalPoints.Text = Translation.GetTranslation(""statusPanelPoints"", ""{0}pts of {1} pts"", WarFoundryCore.CurrentArmy.Points, WarFoundryCore.CurrentArmy.MaxPoints);
89
88
                        }
96
95
 
97
96
                public TextEditor CreateEditor (string editorText)
98
97
                {
99
 
                        return new TextEditor (new Document (editorText));
 
98
                        return new TextEditor (new TextDocument (editorText));
100
99
                }
101
100
 
102
 
                public List<ISegment> BreakAllLines (String editorText)
 
101
                public List<TextSegment> BreakAllLines (String editorText)
103
102
                {
104
103
                        return BreakAllLines (CreateEditor (editorText));
105
104
                }
106
105
 
107
 
                public List<ISegment> BreakAllLines (TextEditor editor)
108
 
                {
109
 
                        return TextBreaker.BreakLinesIntoWords (editor, 1, editor.LineCount);
110
 
                }
111
 
 
112
 
                [TestFixtureSetUp] 
113
 
                public void SetUp ()
114
 
                {
115
 
                        Gtk.Application.Init ();
 
106
                public List<TextSegment> BreakAllLines (TextEditor editor)
 
107
                {
 
108
                        return TextBreaker.BreakLinesIntoWords (editor.Document, 1, editor.LineCount, false);
116
109
                }
117
110
        }
118
111
}