1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
namespace TomboyTest
{
using NUnit.Framework;
using Gtk;
using Tomboy;
[TestFixture]
public class NoteDataTest
{
NoteData note;
[SetUp]
public void Construct ()
{
note = new NoteData ("tomboy://www.example.com/note");
}
[Test]
public void HasPositionAfterConstruction ()
{
Assert.IsFalse (note.HasPosition ());
}
[Test]
public void HasPositionAfterSettingX ()
{
note.X = 5;
Assert.IsFalse (note.HasPosition ());
}
[Test]
public void HasPositionAfterSettingY ()
{
note.Y = 5;
Assert.IsFalse (note.HasPosition ());
}
[Test]
public void HasPositionAfterSettingXY ()
{
note.X = 5;
note.Y = 5;
Assert.IsTrue (note.HasPosition ());
}
[Test]
public void HasPositionAfterSetPositionExtent ()
{
note.SetPositionExtent (0, 0, 5, 5);
Assert.IsTrue (note.HasPosition ());
}
[Test]
public void HasExtentAfterConstruction ()
{
Assert.IsFalse (note.HasExtent ());
}
[Test]
public void HasExtentAfterSettingWidth ()
{
note.Width = 5;
Assert.IsFalse (note.HasExtent ());
}
[Test]
public void HasExtentAfterSettingHeight ()
{
note.Height = 5;
Assert.IsFalse (note.HasExtent ());
}
[Test]
public void HasExtentAfterSettingWidthHeight ()
{
note.Width = 5;
note.Height = 5;
Assert.IsTrue (note.HasExtent ());
}
[Test]
public void HasExtentAfterSetPositionExtent ()
{
note.SetPositionExtent (0, 0, 5, 5);
Assert.IsTrue (note.HasExtent ());
}
}
[TestFixture]
public class NoteDataBufferSynchronizerTest
{
NoteData data;
NoteDataBufferSynchronizer note;
[SetUp]
public void Construct ()
{
data = new NoteData ("http://www.example.com/note");
note = new NoteDataBufferSynchronizer (data);
}
[Test]
public void Text ()
{
Assert.AreEqual ("", note.Text);
}
[Test]
public void ValidText ()
{
data.Text = "<note-content>Foo</note-content>";
Assert.AreEqual ("<note-content>Foo</note-content>", note.Text);
}
}
[TestFixture]
public class NoteDataBufferSynchronizerTestWithBuffer
{
NoteData data;
NoteDataBufferSynchronizer note;
NoteBuffer buffer;
[SetUp]
public void Construct ()
{
data = new NoteData ("http://www.example.com/note");
data.Text = "<note-content>Foo</note-content>";
note = new NoteDataBufferSynchronizer (data);
buffer = new NoteBuffer (new TextTagTable ());
}
[Test]
public void TextAfterAddingBuffer ()
{
buffer.Text = "Bar";
note.Buffer = buffer;
Assert.AreEqual ("<note-content version=\"0.1\">FooBar</note-content>", note.Text);
}
[Test]
public void TextAfterChangingBufferText ()
{
note.Buffer = buffer;
buffer.Text = "Bar";
Assert.AreEqual ("<note-content version=\"0.1\">Bar</note-content>", note.Text);
}
}
[TestFixture]
public class NoteTest
{
[Test]
public void Construct()
{
Note.CreateNewNote ("Note Title", "/tmp/note", null);
}
}
}
|