File: EventArgsTest.cs

package info (click to toggle)
mono 4.6.2.7+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 778,148 kB
  • ctags: 914,052
  • sloc: cs: 5,779,509; xml: 2,773,713; ansic: 432,645; sh: 14,749; makefile: 12,361; perl: 2,488; python: 1,434; cpp: 849; asm: 531; sql: 95; sed: 16; php: 1
file content (700 lines) | stat: -rw-r--r-- 21,605 bytes parent folder | download | duplicates (2)
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;

namespace MonoTests.System.Windows.Forms
{
	[TestFixture]
	public class EventArgsTest : TestHelper
	{
		[Test]
		public void TestBindingCompleteEventArgs ()
		{
			Binding b = new Binding ("TestBind", null, "TestMember");
			BindingCompleteContext c = new BindingCompleteContext ();
			string errorText = "This is an error!";
			Exception ex = new ArgumentNullException ();

			BindingCompleteEventArgs e = new BindingCompleteEventArgs (b, BindingCompleteState.Success, c);

			Assert.AreEqual (b, e.Binding, "A1");
			Assert.AreEqual (BindingCompleteState.Success, e.BindingCompleteState, "A2");
			Assert.AreEqual (c, e.BindingCompleteContext, "A3");
			Assert.AreEqual (false, e.Cancel, "A4");
			Assert.AreEqual (String.Empty, e.ErrorText, "A5");
			Assert.AreEqual (null, e.Exception, "A6");

			BindingCompleteEventArgs e2 = new BindingCompleteEventArgs (b, BindingCompleteState.Success, c, errorText);

			Assert.AreEqual (b, e2.Binding, "B1");
			Assert.AreEqual (BindingCompleteState.Success, e2.BindingCompleteState, "B2");
			Assert.AreEqual (c, e2.BindingCompleteContext, "B3");
			Assert.AreEqual (false, e2.Cancel, "B4");
			Assert.AreEqual (errorText, e2.ErrorText, "B5");
			Assert.AreEqual (null, e2.Exception, "B6");

			BindingCompleteEventArgs e3 = new BindingCompleteEventArgs (b, BindingCompleteState.Success, c, errorText, ex);

			Assert.AreEqual (b, e3.Binding, "C1");
			Assert.AreEqual (BindingCompleteState.Success, e3.BindingCompleteState, "C2");
			Assert.AreEqual (c, e3.BindingCompleteContext, "C3");
			Assert.AreEqual (false, e3.Cancel, "C4");
			Assert.AreEqual (errorText, e3.ErrorText, "C5");
			Assert.AreEqual (ex, e3.Exception, "C6");

			BindingCompleteEventArgs e4 = new BindingCompleteEventArgs (b, BindingCompleteState.Success, c, errorText, ex, true);

			Assert.AreEqual (b, e4.Binding, "D1");
			Assert.AreEqual (BindingCompleteState.Success, e4.BindingCompleteState, "D2");
			Assert.AreEqual (c, e4.BindingCompleteContext, "D3");
			Assert.AreEqual (true, e4.Cancel, "D4");
			Assert.AreEqual (errorText, e4.ErrorText, "D5");
			Assert.AreEqual (ex, e4.Exception, "D6");

		}

		[Test]
		public void TestBindingManagerDataErrorEventArgs ()
		{
			Exception ex = new ArgumentNullException ();

			BindingManagerDataErrorEventArgs e = new BindingManagerDataErrorEventArgs (ex);

			Assert.AreEqual (ex, e.Exception, "A1");
		}

		[Test]
		public void TestCacheVirtualItemsEventArgs ()
		{
			int start = 7;
			int end = 26;

			CacheVirtualItemsEventArgs e = new CacheVirtualItemsEventArgs (start, end);

			Assert.AreEqual (start, e.StartIndex, "A1");
			Assert.AreEqual (end, e.EndIndex, "A2");
		}

		[Test]
		public void TestColumnReorderedEventArgs ()
		{
			int oldindex = 7;
			int newindex = 26;
			ColumnHeader ch = new ColumnHeader ();
			ch.Text = "TestHeader";

			ColumnReorderedEventArgs e = new ColumnReorderedEventArgs (oldindex, newindex, ch);

			Assert.AreEqual (oldindex, e.OldDisplayIndex, "A1");
			Assert.AreEqual (newindex, e.NewDisplayIndex, "A2");
			Assert.AreEqual (ch, e.Header, "A3");
			Assert.AreEqual (false, e.Cancel, "A4");
		}

		[Test]
		public void TestColumnWidthChangedEventArgs ()
		{
			int col = 42;

			ColumnWidthChangedEventArgs e = new ColumnWidthChangedEventArgs (col);

			Assert.AreEqual (col, e.ColumnIndex, "A1");
		}

		[Test]
		public void TestColumnWidthChangingEventArgs ()
		{
			int col = 27;
			int width = 543;

			ColumnWidthChangingEventArgs e = new ColumnWidthChangingEventArgs (col, width);

			Assert.AreEqual (col, e.ColumnIndex, "A1");
			Assert.AreEqual (width, e.NewWidth, "A2");
			Assert.AreEqual (false, e.Cancel, "A3");

			ColumnWidthChangingEventArgs e2 = new ColumnWidthChangingEventArgs (col, width, true);

			Assert.AreEqual (col, e2.ColumnIndex, "B1");
			Assert.AreEqual (width, e2.NewWidth, "B2");
			Assert.AreEqual (true, e2.Cancel, "B3");
		}

		[Test]
		public void TestFormClosedEventArgs ()
		{
			CloseReason cr = CloseReason.WindowsShutDown;

			FormClosedEventArgs e = new FormClosedEventArgs (cr);

			Assert.AreEqual (cr, e.CloseReason, "A1");
		}

		[Test]
		public void TestFormClosingEventArgs ()
		{
			CloseReason cr = CloseReason.WindowsShutDown;

			FormClosingEventArgs e = new FormClosingEventArgs (cr, true);

			Assert.AreEqual (cr, e.CloseReason, "A1");
			Assert.AreEqual (true, e.Cancel, "A2");
		}

		[Test]
		public void TestItemCheckedEventArgs ()
		{
			ListViewItem item = new ListViewItem ("TestItem");

			ItemCheckedEventArgs e = new ItemCheckedEventArgs (item);

			Assert.AreEqual (item, e.Item, "A1");
		}

		[Test]
		public void TestListControlConvertEventArgs ()
		{
			ListViewItem item = new ListViewItem ("TestItem");
			object value = (object)"TestObject";
			Type t = typeof (string);

			ListControlConvertEventArgs e = new ListControlConvertEventArgs (value, t, item);

			Assert.AreEqual (item, e.ListItem, "A1");
			Assert.AreEqual (value, e.Value, "A2");
			Assert.AreEqual (t, e.DesiredType, "A3");
		}

		[Test]
		public void TestListViewItemMouseHoverEventArgs ()
		{
			ListViewItem item = new ListViewItem ("TestItem");

			ListViewItemMouseHoverEventArgs e = new ListViewItemMouseHoverEventArgs (item);

			Assert.AreEqual (item, e.Item, "A1");
		}

		[Test]
		public void TestListViewItemSelectionChangedEventArgs ()
		{
			ListViewItem item = new ListViewItem ("TestItem");
			bool selected = false;
			int index = 35;

			ListViewItemSelectionChangedEventArgs e = new ListViewItemSelectionChangedEventArgs (item, index, selected);

			Assert.AreEqual (item, e.Item, "A1");
			Assert.AreEqual (selected, e.IsSelected, "A2");
			Assert.AreEqual (index, e.ItemIndex, "A3");
		}

		[Test]
		public void TestListViewVirtualItemsSelectionRangeChangedEventArgs ()
		{
			bool selected = false;
			int start = 3;
			int end = 76;

			ListViewVirtualItemsSelectionRangeChangedEventArgs e = new ListViewVirtualItemsSelectionRangeChangedEventArgs (start, end, selected);

			Assert.AreEqual (selected, e.IsSelected, "A1");
			Assert.AreEqual (start, e.StartIndex, "A2");
			Assert.AreEqual (end, e.EndIndex, "A3");
		}

		[Test]
		public void TestMaskInputRejectedEventArgs ()
		{
			int pos = 2;
			MaskedTextResultHint hint = MaskedTextResultHint.InvalidInput;

			MaskInputRejectedEventArgs e = new MaskInputRejectedEventArgs (pos, hint);

			Assert.AreEqual (pos, e.Position, "A1");
			Assert.AreEqual (hint, e.RejectionHint, "A2");
		}

		[Test]
		public void TestPopupEventArgs ()
		{
			Control c = new ListBox ();
			IWin32Window w = null;
			bool balloon = true;
			Size s = new Size (123, 54);

			PopupEventArgs e = new PopupEventArgs (w, c, balloon, s);

			Assert.AreEqual (c, e.AssociatedControl, "A1");
			Assert.AreEqual (w, e.AssociatedWindow, "A2");
			Assert.AreEqual (balloon, e.IsBalloon, "A3");
			Assert.AreEqual (s, e.ToolTipSize, "A4");
		}

		[Test]
		public void TestPreviewKeyDownEventArgs ()
		{
			Keys k = (Keys)196674;  // Control-Shift-B

			PreviewKeyDownEventArgs e = new PreviewKeyDownEventArgs (k);

			Assert.AreEqual (false, e.Alt, "A1");
			Assert.AreEqual (true, e.Control, "A2");
			Assert.AreEqual (false, e.IsInputKey, "A3");
			Assert.AreEqual ((Keys)66, e.KeyCode, "A4");  // B
			Assert.AreEqual (k, e.KeyData, "A5");
			Assert.AreEqual (Convert.ToInt32 (k), e.KeyValue, "A6");
			Assert.AreEqual ((Keys)196608, e.Modifiers, "A7");  // Control + Shift
			Assert.AreEqual (true, e.Shift, "A8");

			e.IsInputKey = true;

			Assert.AreEqual (true, e.IsInputKey, "A9");
		}

		[Test]
		public void TestRetrieveVirtualItemEventArgs()
		{
			ListViewItem item = new ListViewItem("TestItem");
			int index = 75;
			
			RetrieveVirtualItemEventArgs e = new RetrieveVirtualItemEventArgs(index);
			
			Assert.AreEqual(index, e.ItemIndex, "A1");
			Assert.AreEqual(null, e.Item, "A2");
			
			e.Item = item;
			
			Assert.AreEqual(item, e.Item, "A3");
		}
		
		[Test]
		public void TestSearchForVirtualItemEventArgs()
		{
			SearchDirectionHint sdh = SearchDirectionHint.Right;
			bool includesubitems = true;
			int index = 84;
			bool isprefix = true;
			bool istext = false;
			int start = 34;
			Point startpoint = new Point(64,35);
			string text = "HiThere!";
			
			SearchForVirtualItemEventArgs e = new SearchForVirtualItemEventArgs(istext, isprefix, includesubitems, text, startpoint, sdh, start);
			
			Assert.AreEqual(sdh, e.Direction, "A1");
			Assert.AreEqual(includesubitems, e.IncludeSubItemsInSearch, "A2");
			Assert.AreEqual(-1, e.Index, "A3");
			Assert.AreEqual(isprefix, e.IsPrefixSearch, "A4");
			Assert.AreEqual(istext, e.IsTextSearch, "A5");
			Assert.AreEqual(start, e.StartIndex, "A6");
			Assert.AreEqual(startpoint, e.StartingPoint, "A7");
			Assert.AreEqual(text, e.Text, "A8");
			
			e.Index = index;
			Assert.AreEqual(index, e.Index, "A9");
		}
		
		[Test]
		public void TestSplitterCancelEventArgs()
		{
			int mx = 23;
			int my = 33;
			int sx = 43;
			int sy = 53;
			
			SplitterCancelEventArgs e = new SplitterCancelEventArgs(mx, my, sx, sy);
			
			Assert.AreEqual(mx, e.MouseCursorX, "A1");
			Assert.AreEqual(my, e.MouseCursorY, "A2");
			Assert.AreEqual(sx, e.SplitX, "A3");
			Assert.AreEqual(sy, e.SplitY, "A4");
			
			e.SplitX = 11;
			e.SplitY = 12;
			
			Assert.AreEqual(11, e.SplitX, "A5");
			Assert.AreEqual(12, e.SplitY, "A6");
		}
		
		[Test]
		public void TestTabControlCancelEventArgs()
		{
			TabControlAction tca = TabControlAction.Deselecting;
			TabPage tp = new TabPage("HI!");
			int index = 477;
			
			TabControlCancelEventArgs e = new TabControlCancelEventArgs(tp, index, true, tca);
			
			Assert.AreEqual(tca, e.Action, "A1");
			Assert.AreEqual(tp, e.TabPage, "A2");
			Assert.AreEqual(index, e.TabPageIndex, "A3");
			Assert.AreEqual(true, e.Cancel, "A4");
		}

		[Test]
		public void TestTabControlEventArgs ()
		{
			TabControlAction tca = TabControlAction.Selected;
			TabPage tp = new TabPage ("HI!");
			int index = 477;

			TabControlEventArgs e = new TabControlEventArgs (tp, index, tca);

			Assert.AreEqual (tca, e.Action, "A1");
			Assert.AreEqual (tp, e.TabPage, "A2");
			Assert.AreEqual (index, e.TabPageIndex, "A3");
		}
		
		[Test]
		public void TestTableLayoutCellPaintEventArgs()
		{
			Rectangle bounds = new Rectangle(0, 0, 100, 200);
			Rectangle clip = new Rectangle(50, 50, 50, 50);
			int col = 54;
			int row = 77;
			Bitmap b = new Bitmap(100, 100);
			Graphics g = Graphics.FromImage(b);
			
			TableLayoutCellPaintEventArgs e = new TableLayoutCellPaintEventArgs(g, clip, bounds, col, row);
			
			Assert.AreEqual(bounds, e.CellBounds, "A1");
			Assert.AreEqual(col, e.Column, "A2");
			Assert.AreEqual(row, e.Row, "A3");
			Assert.AreEqual(g, e.Graphics, "A4");
			Assert.AreEqual(clip, e.ClipRectangle, "A5");
		}
		
		[Test]
		public void TestToolStripDropDownClosedEventArgs()
		{
			ToolStripDropDownCloseReason cr = ToolStripDropDownCloseReason.CloseCalled;
			
			ToolStripDropDownClosedEventArgs e = new ToolStripDropDownClosedEventArgs(cr);
			
			Assert.AreEqual(cr, e.CloseReason, "A1");
		}

		[Test]
		public void TestToolStripDropDownClosingEventArgs ()
		{
			ToolStripDropDownCloseReason cr = ToolStripDropDownCloseReason.CloseCalled;

			ToolStripDropDownClosingEventArgs e = new ToolStripDropDownClosingEventArgs (cr);

			Assert.AreEqual (cr, e.CloseReason, "A1");
		}
		
		[Test]
		public void TestTreeNodeMouseClickEventArgs()
		{
			TreeNode tn = new TreeNode("HI");
			int clicks = 4;
			int x = 75;
			int y = 34;
			MouseButtons mb = MouseButtons.Right;
			
			TreeNodeMouseClickEventArgs e = new TreeNodeMouseClickEventArgs(tn, mb, clicks, x, y);
			
			Assert.AreEqual(tn, e.Node, "A1");
			Assert.AreEqual(clicks, e.Clicks, "A2");
			Assert.AreEqual(x, e.X, "A3");
			Assert.AreEqual(y, e.Y, "A4");
			Assert.AreEqual(mb, e.Button, "A5");
		}

		[Test]
		public void TestTreeNodeMouseHoverEventArgs ()
		{
			TreeNode tn = new TreeNode ("HI");

			TreeNodeMouseHoverEventArgs e = new TreeNodeMouseHoverEventArgs (tn);

			Assert.AreEqual (tn, e.Node, "A1");
		}

		[Test]
		public void TestTypeValidationEventArgs()
		{
			bool valid = true;
			string message = "This is a test.";
			object rv = (object) "MyObject";
			Type vt = typeof(int);
			
			TypeValidationEventArgs e = new TypeValidationEventArgs (vt, valid, rv, message);
			
			Assert.AreEqual(valid, e.IsValidInput, "A1");
			Assert.AreEqual(message, e.Message, "A2");
			Assert.AreEqual(rv, e.ReturnValue, "A3");
			Assert.AreEqual(vt, e.ValidatingType, "A4");
			Assert.AreEqual(false, e.Cancel, "A5");
			
			e.Cancel = true;
			
			Assert.AreEqual(true, e.Cancel, "A6");
		}
		
		[Test]
		public void TestWebBrowserDocumentCompletedEventArgs()
		{
			Uri url = new Uri("http://www.mono-project.com/");
			
			WebBrowserDocumentCompletedEventArgs e = new WebBrowserDocumentCompletedEventArgs(url);
			
			Assert.AreEqual(url, e.Url, "A1");
		}

		[Test]
		public void TestWebBrowserNavigatedEventArgs ()
		{
			Uri url = new Uri ("http://www.mono-project.com/");

			WebBrowserNavigatedEventArgs e = new WebBrowserNavigatedEventArgs (url);

			Assert.AreEqual (url, e.Url, "A1");
		}

		[Test]
		public void TestWebBrowserNavigatingEventArgs ()
		{
			Uri url = new Uri ("http://www.mono-project.com/");
			string frame = "TOP";

			WebBrowserNavigatingEventArgs e = new WebBrowserNavigatingEventArgs (url, frame);

			Assert.AreEqual (url, e.Url, "A1");
			Assert.AreEqual(frame, e.TargetFrameName, "A2");
		}

		[Test]
		public void TestWebBrowserProgressChangedEventArgs ()
		{
			long current = 3000;
			long max = 5000;

			WebBrowserProgressChangedEventArgs e = new WebBrowserProgressChangedEventArgs (current, max);

			Assert.AreEqual (current, e.CurrentProgress, "A1");
			Assert.AreEqual (max, e.MaximumProgress, "A2");
		}

		[Test]
		public void TestToolStripArrowRenderEventArgs ()
		{
			Graphics g = Graphics.FromImage(new Bitmap(5,5));
			ToolStripItem tsi = new ToolStripButton();
			Rectangle r = new Rectangle(0,0,10,10);
			ToolStripArrowRenderEventArgs e = new ToolStripArrowRenderEventArgs(g,tsi,r,Color.BurlyWood, ArrowDirection.Down);
			
			Assert.AreEqual(g, e.Graphics, "A1");
			Assert.AreEqual(tsi, e.Item, "A2");
			Assert.AreEqual(r, e.ArrowRectangle, "A3");
			Assert.AreEqual(Color.BurlyWood, e.ArrowColor, "A4");
			Assert.AreEqual(ArrowDirection.Down, e.Direction, "A5");
			
			Rectangle r2 = new Rectangle(0,0,5,5);
			
			e.ArrowColor = Color.BlanchedAlmond;
			e.ArrowRectangle = r2;
			e.Direction = ArrowDirection.Right;

			Assert.AreEqual (Color.BlanchedAlmond, e.ArrowColor, "A6");
			Assert.AreEqual (r2, e.ArrowRectangle, "A7");
			Assert.AreEqual (ArrowDirection.Right, e.Direction, "A8");
		}
		
		[Test]
		public void TestToolStripContentPanelRenderEventArgs()
		{
			Graphics g = Graphics.FromImage (new Bitmap (5, 5));
			ToolStripContentPanel tscp = new ToolStripContentPanel();
			ToolStripContentPanelRenderEventArgs e = new ToolStripContentPanelRenderEventArgs(g, tscp);

			Assert.AreEqual (g, e.Graphics, "BBB1");
			Assert.AreEqual (false, e.Handled, "BBB2");
			Assert.AreEqual (tscp, e.ToolStripContentPanel, "BBB3");	
			
			e.Handled = true;

			Assert.AreEqual (true, e.Handled, "BBB4");
		}
		
		[Test]
		public void TestToolStripGripRenderEventArgs()
		{
			Graphics g = Graphics.FromImage (new Bitmap (5, 5));
			ToolStrip ts = new ToolStrip();
			ToolStripGripRenderEventArgs e = new ToolStripGripRenderEventArgs(g, ts);

			Assert.AreEqual (new Rectangle(2,0,3,25), e.GripBounds, "CCC1");
			Assert.AreEqual (ToolStripGripDisplayStyle.Vertical, e.GripDisplayStyle, "CCC1");
			Assert.AreEqual (ToolStripGripStyle.Visible, e.GripStyle, "CCC3");
			Assert.AreEqual (g, e.Graphics, "CCC4");
			Assert.AreEqual (ts, e.ToolStrip, "CCC5");
	
		}
		
		[Test]
		public void TestToolStripItemClickedEventArgs()
		{
			ToolStripItem tsi = new ToolStripButton ();
			ToolStripItemClickedEventArgs e = new ToolStripItemClickedEventArgs(tsi);

			Assert.AreEqual (tsi, e.ClickedItem, "DDD1");
		}
		
		[Test]
		public void TestToolStripItemEventArgs()
		{
			ToolStripItem tsi = new ToolStripButton ();
			ToolStripItemEventArgs e = new ToolStripItemEventArgs(tsi);

			Assert.AreEqual (tsi, e.Item, "EEE1");
		}
		
		[Test]
		public void TestToolStripItemImageRenderEventArgs()
		{
			Graphics g = Graphics.FromImage (new Bitmap (5, 5));
			ToolStripItem tsi = new ToolStripButton ();
			Rectangle r = new Rectangle(0,0,16,16);
			ToolStripItemImageRenderEventArgs e = new ToolStripItemImageRenderEventArgs(g, tsi, r);

			Assert.AreEqual (g, e.Graphics, "FFF1");
			Assert.AreEqual (tsi, e.Item, "FFF2");
			Assert.AreEqual (r, e.ImageRectangle, "FFF3");
			Assert.AreEqual (null, e.Image, "FFF4");
			
			Image i = new Bitmap(16,16);
			e = new ToolStripItemImageRenderEventArgs (g, tsi, i, r);

			Assert.AreEqual (g, e.Graphics, "FFF5");
			Assert.AreEqual (tsi, e.Item, "FFF6");
			Assert.AreEqual (r, e.ImageRectangle, "FFF7");
			Assert.AreEqual (i, e.Image, "FFF8");
		}
		
		[Test]
		public void TestToolStripItemRenderEventArgs()
		{
			Graphics g = Graphics.FromImage (new Bitmap (5, 5));
			ToolStripItem tsi = new ToolStripButton ();
			ToolStripItemRenderEventArgs e = new ToolStripItemRenderEventArgs(g, tsi);

			Assert.AreEqual (g, e.Graphics, "GGG1");
			Assert.AreEqual (tsi, e.Item, "GGG2");
			Assert.AreEqual (null, e.ToolStrip, "GGG3");
		}
		
		[Test]
		public void TestToolStripItemTextRenderEventArgs()
		{
			Graphics g = Graphics.FromImage (new Bitmap (5, 5));
			ToolStripItem tsi = new ToolStripButton ();
			string text = "Test String";
			Rectangle r = new Rectangle(0,0,15,15);
			Color c = Color.Bisque;
			Font f = new Font("Arial", 12);
			
			ToolStripItemTextRenderEventArgs e = new ToolStripItemTextRenderEventArgs(g,tsi,text,r,c,f, ContentAlignment.BottomRight);

			Assert.AreEqual (g, e.Graphics, "HHH1");
			Assert.AreEqual (tsi, e.Item, "HHH2");
			Assert.AreEqual (text, e.Text, "HHH3");
			Assert.AreEqual (r, e.TextRectangle, "HHH4");
			Assert.AreEqual (c, e.TextColor, "HHH5");
			Assert.AreEqual (f, e.TextFont, "HHH6");
			Assert.AreEqual (ToolStripTextDirection.Horizontal, e.TextDirection, "HHH7");
			Assert.AreEqual (TextFormatFlags.Bottom | TextFormatFlags.Right | TextFormatFlags.HidePrefix, e.TextFormat, "HHH8");
			Assert.AreEqual (null, e.ToolStrip, "HHH9");

			e = new ToolStripItemTextRenderEventArgs (g, tsi, text, r, c, f, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);

			Assert.AreEqual (g, e.Graphics, "HHH10");
			Assert.AreEqual (tsi, e.Item, "HHH11");
			Assert.AreEqual (text, e.Text, "HHH12");
			Assert.AreEqual (r, e.TextRectangle, "HHH13");
			Assert.AreEqual (c, e.TextColor, "HHH14");
			Assert.AreEqual (f, e.TextFont, "HHH15");
			Assert.AreEqual (ToolStripTextDirection.Horizontal, e.TextDirection, "HHH16");
			Assert.AreEqual (TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter, e.TextFormat, "HHH17");
			Assert.AreEqual (null, e.ToolStrip, "HHH18");
			
			Font f2 = new Font("Tahoma", 14);
			Rectangle r2 = new Rectangle(0,0,100,100);
			
			e.Text = "More Text";
			e.TextColor = Color.Khaki;
			e.TextDirection = ToolStripTextDirection.Vertical270;
			e.TextFont = f2;
			e.TextFormat = TextFormatFlags.SingleLine;
			e.TextRectangle = r2;

			Assert.AreEqual ("More Text", e.Text, "HHH19");
			Assert.AreEqual (r2, e.TextRectangle, "HHH20");
			Assert.AreEqual (Color.Khaki, e.TextColor, "HHH21");
			Assert.AreEqual (f2, e.TextFont, "HHH22");
			Assert.AreEqual (ToolStripTextDirection.Vertical270, e.TextDirection, "HHH23");
			Assert.AreEqual (TextFormatFlags.SingleLine, e.TextFormat, "HHH24");
		}
		
		[Test]
		public void TestToolStripPanelRenderEventArgs()
		{
			Graphics g = Graphics.FromImage (new Bitmap (5, 5));
			ToolStripPanel tsp = new ToolStripPanel();
			
			ToolStripPanelRenderEventArgs e = new ToolStripPanelRenderEventArgs(g, tsp);

			Assert.AreEqual (g, e.Graphics, "III1");
			Assert.AreEqual (false, e.Handled, "III2");
			Assert.AreEqual (tsp, e.ToolStripPanel, "III3");
			
			e.Handled = true;

			Assert.AreEqual (true, e.Handled, "III2");
		}
		
		[Test]
		public void TestToolStripRenderEventArgs()
		{
			Graphics g = Graphics.FromImage (new Bitmap (5, 5));
			ToolStrip ts = new ToolStrip();
			
			ToolStripRenderEventArgs e = new ToolStripRenderEventArgs(g, ts);

			Assert.AreEqual (g, e.Graphics, "JJJ1");
			Assert.AreEqual (new Rectangle(0,0,100,25) , e.AffectedBounds, "JJJ2");
			Assert.AreEqual (SystemColors.Control, e.BackColor, "JJJ3");
			Assert.AreEqual (Rectangle.Empty, e.ConnectedArea, "JJJ4");
			Assert.AreEqual (ts, e.ToolStrip, "JJJ5");

			Rectangle r = new Rectangle (0, 23, 40, 100);
			e = new ToolStripRenderEventArgs (g, ts, r, Color.DodgerBlue);

			Assert.AreEqual (g, e.Graphics, "JJJ6");
			Assert.AreEqual (r, e.AffectedBounds, "JJJ7");
			Assert.AreEqual (Color.DodgerBlue, e.BackColor, "JJJ8");
			Assert.AreEqual (Rectangle.Empty, e.ConnectedArea, "JJJ9");
			Assert.AreEqual (ts, e.ToolStrip, "JJJ10");
		}
		
		[Test]
		public void TestToolStripSeparatorRenderEventArgs()
		{
			Graphics g = Graphics.FromImage (new Bitmap (5, 5));
			ToolStripSeparator tss = new ToolStripSeparator();
			
			ToolStripSeparatorRenderEventArgs e = new ToolStripSeparatorRenderEventArgs(g, tss, true);

			Assert.AreEqual (g, e.Graphics, "LLL1");
			Assert.AreEqual (tss, e.Item, "LLL2");
			Assert.AreEqual (true, e.Vertical, "LLL3");
			Assert.AreEqual (null, e.ToolStrip, "LLL4");
		}
	}
}