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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
using System;
using NUnit.Framework;
using System.Windows.Forms;
using System.Drawing;
using System.Threading;
namespace MonoTests.System.Windows.Forms
{
[TestFixture]
[Ignore ("This test has to be completly reviewed")]
public class EventClass
{
static bool eventhandled = false;
public static void Event_Handler1 (object sender, EventArgs e)
{
eventhandled = true;
}
[Test]
public void BackColorChangedTest ()
{
Control c = new Control ();
// Test BackColorChanged Event
c.BackColorChanged += new EventHandler (Event_Handler1);
c.BackColor = Color.Black;
Assert.AreEqual (true, eventhandled, "#A1");
}
[Test]
public void BgrndImageChangedTest ()
{
Control c = new Control ();
// Test BackgroundImageChanged Event
c.BackgroundImageChanged += new EventHandler (Event_Handler1);
string abc = "M.gif";
eventhandled = false;
c.BackgroundImage = Image.FromFile (abc);
Assert.AreEqual (true, eventhandled, "#A2");
}
[Test]
public void BindingContextChangedTest ()
{
Control c = new Control ();
// Test BindingContextChanged Event
c.BindingContextChanged += new EventHandler (Event_Handler1);
BindingContext bcG1 = new BindingContext ();
eventhandled = false;
c.BindingContext = bcG1;
Assert.AreEqual (true, eventhandled, "#A3");
}
[Test]
public void CausesValidationChangedTest ()
{
Control c = new Control ();
// Test CausesValidationChanged Event
c.CausesValidationChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.CausesValidation = false;
Assert.AreEqual (true, eventhandled, "#A4");
}
[Test]
public void CursorChangedTest ()
{
Control c = new Control ();
// Test CursorChanged Event
c.CursorChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.Cursor = Cursors.Hand;
Assert.AreEqual (true, eventhandled, "#A6");
}
[Test]
public void DisposedTest ()
{
Control c = new Control ();
// Test Disposed Event
c.Disposed += new EventHandler (Event_Handler1);
eventhandled = false;
c.Dispose ();
Assert.AreEqual (true, eventhandled, "#A7");
}
[Test]
public void DockChangedTest ()
{
Control c = new Control ();
// Test DockChanged Event
c.DockChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.Dock = DockStyle.Bottom;
Assert.AreEqual (true, eventhandled, "#A8");
}
[Test]
public void EnabledChangedTest ()
{
Control c = new Control ();
// Test EnabledChanged Event
c.EnabledChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.Enabled = false;
Assert.AreEqual (true, eventhandled, "#A9");
}
[Test]
public void FontChangedTest ()
{
Control c = new Control ();
// Test FontChanged Event
c.FontChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.Font = new Font (c.Font, FontStyle.Bold);
Assert.AreEqual (true, eventhandled, "#A11");
}
[Test]
public void ForeColorChangedTest ()
{
Control c = new Control ();
// Test ForeColorChanged Event
c.ForeColorChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.ForeColor = Color.Red;
Assert.AreEqual (true, eventhandled, "#A12");
}
[Test]
public void HandleCreatedTest ()
{
Control c = new Control ();
// Test HandleCreated Event
c.HandleCreated += new EventHandler (Event_Handler1);
eventhandled = false;
c.Handle.GetType ();
Assert.AreEqual (true, eventhandled, "#A15");
}
[Test]
public void ImeModeChangedTest ()
{
Control c = new Control ();
// Test ImeModeChanged Event
c.ImeModeChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.ImeMode = ImeMode.Off;
Assert.AreEqual (true, eventhandled, "#A19");
}
[Test]
public void LocationChangedTest ()
{
Control c = new Control ();
// Test LocationChanged Event
c.LocationChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.Left = 20;
Assert.AreEqual (true, eventhandled, "#A20");
}
[Test]
public void ResizeTest ()
{
Control c = new Control ();
// Test Resize Event
c.Resize += new EventHandler (Event_Handler1);
eventhandled = false;
c.Height = 20;
Assert.AreEqual (true, eventhandled, "#A22");
}
[Test]
public void RightToLeftChangedTest ()
{
Control c = new Control ();
// Test RightToLeftChanged Event
c.RightToLeftChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.RightToLeft = RightToLeft.Yes;
Assert.AreEqual (true, eventhandled, "#A23");
}
[Test]
public void SizeChangedTest ()
{
Control c = new Control ();
// Test SizeChanged Event
c.SizeChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.Height = 80;
Assert.AreEqual (true, eventhandled, "#A24");
}
[Test]
public void TabIndexChangedTest ()
{
Control c = new Control ();
// Test TabIndexChanged Event
c.TabIndexChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.TabIndex = 1;
Assert.AreEqual (true, eventhandled, "#A27");
}
[Test]
public void TabStopChangedTest ()
{
Control c = new Control ();
// Test TabStopChanged Event
c.TabStopChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.TabStop = false;
Assert.AreEqual (true, eventhandled, "#A28");
}
[Test]
public void TextChangedTest ()
{
Control c = new Control ();
// Test TextChanged Event
c.TextChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.Text = "some Text";
Assert.AreEqual (true, eventhandled, "#A29");
}
[Test]
public void VisibleChangedTest ()
{
Control c = new Control ();
// Test VisibleChanged Event
c.VisibleChanged += new EventHandler (Event_Handler1);
eventhandled = false;
c.Visible = false;
Assert.AreEqual (true, eventhandled, "#A30");
}
}
[TestFixture]
public class LayoutEventClass
{
static bool eventhandled = false;
public static void LayoutEvent (object sender, LayoutEventArgs e)
{
eventhandled = true;
}
[Test]
public void LayoutTest ()
{
Control c = new Control ();
c.Layout += new LayoutEventHandler (LayoutEvent);
eventhandled = false;
c.Visible = true;
c.Height = 100;
Assert.AreEqual (true, eventhandled, "#D1");
}
}
[TestFixture]
public class ControlAddRemoveEventClass
{
static bool eventhandled = false;
public static void ControlEvent (object sender, ControlEventArgs e)
{
eventhandled = true;
}
[Test]
public void ControlAddedTest ()
{
Control c = new Control ();
c.ControlAdded += new ControlEventHandler (ControlEvent);
TextBox TB = new TextBox ();
eventhandled = false;
c.Controls.Add (TB);
Assert.AreEqual (true, eventhandled, "#F1");
}
[Test]
public void ControlRemovedTest ()
{
Control c = new Control ();
c.ControlRemoved += new ControlEventHandler (ControlEvent);
TextBox TB = new TextBox ();
c.Controls.Add (TB);
eventhandled = false;
c.Controls.Remove (TB);
Assert.AreEqual (true, eventhandled, "#F2");
}
}
}
|