2 // Copyright (c) 2005 Novell, Inc.
5 // Hisham Mardam Bey (hisham.mardambey@gmail.com)
10 using NUnit.Framework;
11 using System.Windows.Forms;
13 using System.Collections;
15 namespace MonoTests.System.Windows.Forms
17 internal enum WndMsg {
25 WM_KILLFOCUS = 0x0008,
26 // public const uint WM_SETVISIBLE = 0x0009;
28 WM_SETREDRAW = 0x000B,
31 WM_GETTEXTLENGTH = 0x000E,
34 WM_QUERYENDSESSION = 0x0011,
36 WM_QUERYOPEN = 0x0013,
37 WM_ERASEBKGND = 0x0014,
38 WM_SYSCOLORCHANGE = 0x0015,
39 WM_ENDSESSION = 0x0016,
40 // public const uint WM_SYSTEMERROR = 0x0017;
41 WM_SHOWWINDOW = 0x0018,
43 WM_WININICHANGE = 0x001A,
44 WM_SETTINGCHANGE = 0x001A,
45 WM_DEVMODECHANGE = 0x001B,
46 WM_ACTIVATEAPP = 0x001C,
47 WM_FONTCHANGE = 0x001D,
48 WM_TIMECHANGE = 0x001E,
49 WM_CANCELMODE = 0x001F,
50 WM_SETCURSOR = 0x0020,
51 WM_MOUSEACTIVATE = 0x0021,
52 WM_CHILDACTIVATE = 0x0022,
53 WM_QUEUESYNC = 0x0023,
54 WM_GETMINMAXINFO = 0x0024,
55 WM_PAINTICON = 0x0026,
56 WM_ICONERASEBKGND = 0x0027,
57 WM_NEXTDLGCTL = 0x0028,
58 // public const uint WM_ALTTABACTIVE = 0x0029;
59 WM_SPOOLERSTATUS = 0x002A,
61 WM_MEASUREITEM = 0x002C,
62 WM_DELETEITEM = 0x002D,
63 WM_VKEYTOITEM = 0x002E,
64 WM_CHARTOITEM = 0x002F,
67 WM_SETHOTKEY = 0x0032,
68 WM_GETHOTKEY = 0x0033,
69 // public const uint WM_FILESYSCHANGE = 0x0034;
70 // public const uint WM_ISACTIVEICON = 0x0035;
71 // public const uint WM_QUERYPARKICON = 0x0036;
72 WM_QUERYDRAGICON = 0x0037,
73 WM_COMPAREITEM = 0x0039,
74 // public const uint WM_TESTING = 0x003a;
75 // public const uint WM_OTHERWINDOWCREATED = 0x003c;
76 WM_GETOBJECT = 0x003D,
77 // public const uint WM_ACTIVATESHELLWINDOW = 0x003e;
78 WM_COMPACTING = 0x0041,
79 WM_COMMNOTIFY = 0x0044 ,
80 WM_WINDOWPOSCHANGING = 0x0046,
81 WM_WINDOWPOSCHANGED = 0x0047,
84 WM_CANCELJOURNAL = 0x004B,
86 WM_INPUTLANGCHANGEREQUEST = 0x0050,
87 WM_INPUTLANGCHANGE = 0x0051,
90 WM_USERCHANGED = 0x0054,
91 WM_NOTIFYFORMAT = 0x0055,
92 WM_CONTEXTMENU = 0x007B,
93 WM_STYLECHANGING = 0x007C,
94 WM_STYLECHANGED = 0x007D,
95 WM_DISPLAYCHANGE = 0x007E,
98 // Non-Client messages
100 WM_NCCREATE = 0x0081,
101 WM_NCDESTROY = 0x0082,
102 WM_NCCALCSIZE = 0x0083,
103 WM_NCHITTEST = 0x0084,
105 WM_NCACTIVATE = 0x0086,
106 WM_GETDLGCODE = 0x0087,
107 WM_SYNCPAINT = 0x0088,
108 // public const uint WM_SYNCTASK = 0x0089;
109 WM_NCMOUSEMOVE = 0x00A0,
110 WM_NCLBUTTONDOWN = 0x00A1,
111 WM_NCLBUTTONUP = 0x00A2,
112 WM_NCLBUTTONDBLCLK = 0x00A3,
113 WM_NCRBUTTONDOWN = 0x00A4,
114 WM_NCRBUTTONUP = 0x00A5,
115 WM_NCRBUTTONDBLCLK = 0x00A6,
116 WM_NCMBUTTONDOWN = 0x00A7,
117 WM_NCMBUTTONUP = 0x00A8,
118 WM_NCMBUTTONDBLCLK = 0x00A9,
119 // public const uint WM_NCXBUTTONDOWN = 0x00ab;
120 // public const uint WM_NCXBUTTONUP = 0x00ac;
121 // public const uint WM_NCXBUTTONDBLCLK = 0x00ad;
123 WM_KEYFIRST = 0x0100,
126 WM_DEADCHAR = 0x0103,
127 WM_SYSKEYDOWN = 0x0104,
128 WM_SYSKEYUP = 0x0105,
130 WM_SYSDEADCHAR = 0x0107,
132 WM_IME_STARTCOMPOSITION = 0x010D,
133 WM_IME_ENDCOMPOSITION = 0x010E,
134 WM_IME_COMPOSITION = 0x010F,
135 WM_IME_KEYLAST = 0x010F,
136 WM_INITDIALOG = 0x0110,
138 WM_SYSCOMMAND = 0x0112,
142 WM_INITMENU = 0x0116,
143 WM_INITMENUPOPUP = 0x0117,
144 // public const uint WM_SYSTIMER = 0x0118;
145 WM_MENUSELECT = 0x011F,
146 WM_MENUCHAR = 0x0120,
147 WM_ENTERIDLE = 0x0121,
148 WM_MENURBUTTONUP = 0x0122,
149 WM_MENUDRAG = 0x0123,
150 WM_MENUGETOBJECT = 0x0124,
151 WM_UNINITMENUPOPUP = 0x0125,
152 WM_MENUCOMMAND = 0x0126,
153 // public const uint WM_CHANGEUISTATE = 0x0127;
154 // public const uint WM_UPDATEUISTATE = 0x0128;
155 // public const uint WM_QUERYUISTATE = 0x0129;
157 // public const uint WM_LBTRACKPOINT = 0x0131;
158 WM_CTLCOLORMSGBOX = 0x0132,
159 WM_CTLCOLOREDIT = 0x0133,
160 WM_CTLCOLORLISTBOX = 0x0134,
161 WM_CTLCOLORBTN = 0x0135,
162 WM_CTLCOLORDLG = 0x0136,
163 WM_CTLCOLORSCROLLBAR = 0x0137,
164 WM_CTLCOLORSTATIC = 0x0138,
165 WM_MOUSEMOVE = 0x0200,
166 WM_MOUSEFIRST = 0x0200,
167 WM_LBUTTONDOWN = 0x0201,
168 WM_LBUTTONUP = 0x0202,
169 WM_LBUTTONDBLCLK = 0x0203,
170 WM_RBUTTONDOWN = 0x0204,
171 WM_RBUTTONUP = 0x0205,
172 WM_RBUTTONDBLCLK = 0x0206,
173 WM_MBUTTONDOWN = 0x0207,
174 WM_MBUTTONUP = 0x0208,
175 WM_MBUTTONDBLCLK = 0x0209,
176 WM_MOUSEWHEEL = 0x020A,
177 WM_MOUSELAST = 0x020D,
178 // public const uint WM_XBUTTONDOWN = 0x020B;
179 // public const uint WM_XBUTTONUP = 0x020C;
180 // public const uint WM_XBUTTONDBLCLK = 0x020D;
181 WM_PARENTNOTIFY = 0x0210,
182 WM_ENTERMENULOOP = 0x0211,
183 WM_EXITMENULOOP = 0x0212,
184 WM_NEXTMENU = 0x0213,
186 WM_CAPTURECHANGED = 0x0215,
188 // public const uint WM_POWERBROADCAST = 0x0218;
189 WM_DEVICECHANGE = 0x0219,
190 WM_MDICREATE = 0x0220,
191 WM_MDIDESTROY = 0x0221,
192 WM_MDIACTIVATE = 0x0222,
193 WM_MDIRESTORE = 0x0223,
195 WM_MDIMAXIMIZE = 0x0225,
197 WM_MDICASCADE = 0x0227,
198 WM_MDIICONARRANGE = 0x0228,
199 WM_MDIGETACTIVE = 0x0229,
201 // public const uint WM_DROPOBJECT = 0x022A;
202 // public const uint WM_QUERYDROPOBJECT = 0x022B;
203 // public const uint WM_BEGINDRAG = 0x022C;
204 // public const uint WM_DRAGLOOP = 0x022D;
205 // public const uint WM_DRAGSELECT = 0x022E;
206 // public const uint WM_DRAGMOVE = 0x022F;
207 WM_MDISETMENU = 0x0230,
208 WM_ENTERSIZEMOVE = 0x0231,
209 WM_EXITSIZEMOVE = 0x0232,
210 WM_DROPFILES = 0x0233,
211 WM_MDIREFRESHMENU = 0x0234,
212 WM_IME_SETCONTEXT = 0x0281,
213 WM_IME_NOTIFY = 0x0282,
214 WM_IME_CONTROL = 0x0283,
215 WM_IME_COMPOSITIONFULL = 0x0284,
216 WM_IME_SELECT = 0x0285,
217 WM_IME_CHAR = 0x0286,
218 WM_IME_REQUEST = 0x0288,
219 WM_IME_KEYDOWN = 0x0290,
220 WM_IME_KEYUP = 0x0291,
221 WM_MOUSEHOVER = 0x02A1,
222 WM_MOUSELEAVE = 0x02A3,
228 WM_RENDERFORMAT = 0x0305,
229 WM_RENDERALLFORMATS = 0x0306,
230 WM_DESTROYCLIPBOARD = 0x0307,
231 WM_DRAWCLIPBOARD = 0x0308,
232 WM_PAINTCLIPBOARD = 0x0309,
233 WM_VSCROLLCLIPBOARD = 0x030A,
234 WM_SIZECLIPBOARD = 0x030B,
235 WM_ASKCBFORMATNAME = 0x030C,
236 WM_CHANGECBCHAIN = 0x030D,
237 WM_HSCROLLCLIPBOARD = 0x030E,
238 WM_QUERYNEWPALETTE = 0x030F,
239 WM_PALETTEISCHANGING = 0x0310,
240 WM_PALETTECHANGED = 0x0311,
243 WM_PRINTCLIENT = 0x0318,
244 WM_HANDHELDFIRST = 0x0358,
245 WM_HANDHELDLAST = 0x035F,
246 WM_AFXFIRST = 0x0360,
248 WM_PENWINFIRST = 0x0380,
249 WM_PENWINLAST = 0x038F,
253 // Our "private" ones
254 WM_MOUSE_ENTER = 0x0401,
255 WM_MOUSE_LEAVE = 0x0402,
256 WM_ASYNC_MESSAGE = 0x0403,
257 WM_REFLECT = WM_USER + 0x1c00
262 public class LabelTest2
266 public void PubPropTest ()
268 Label l = new Label ();
271 Assert.AreEqual (false, l.AutoSize, "A1");
273 Assert.AreEqual (true, l.AutoSize, "A2");
275 Assert.AreEqual (false, l.AutoSize, "A3");
278 Assert.AreEqual (null, l.BackgroundImage, "B1");
279 l.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
280 Assert.IsNotNull (l.BackgroundImage, "B2");
281 Bitmap bmp = (Bitmap)l.BackgroundImage;
282 Assert.IsNotNull (bmp.GetPixel (0, 0), "B3");
284 Assert.AreEqual (BorderStyle.None, l.BorderStyle, "B4");
285 l.BorderStyle = BorderStyle.FixedSingle;
286 Assert.AreEqual (BorderStyle.FixedSingle, l.BorderStyle, "B5");
287 l.BorderStyle = BorderStyle.Fixed3D;
288 Assert.AreEqual (BorderStyle.Fixed3D, l.BorderStyle, "B6");
289 l.BorderStyle = BorderStyle.None;
290 Assert.AreEqual (BorderStyle.None, l.BorderStyle, "B7");
293 string name = l.CompanyName;
294 if (!name.Equals("Mono Project, Novell, Inc.") && !name.Equals("Microsoft Corporation")) {
295 Assert.Fail("CompanyName property does not match any accepted value - C1");
300 Assert.AreEqual (FlatStyle.Standard, l.FlatStyle, "F1");
301 l.FlatStyle = FlatStyle.Flat;
302 Assert.AreEqual (FlatStyle.Flat, l.FlatStyle, "F1");
303 l.FlatStyle = FlatStyle.Popup;
304 Assert.AreEqual (FlatStyle.Popup, l.FlatStyle, "F2");
305 l.FlatStyle = FlatStyle.Standard;
306 Assert.AreEqual (FlatStyle.Standard, l.FlatStyle, "F3");
307 l.FlatStyle = FlatStyle.System;
308 Assert.AreEqual (FlatStyle.System, l.FlatStyle, "F4");
311 Assert.AreEqual (ContentAlignment.MiddleCenter, l.ImageAlign, "I1");
312 l.ImageAlign = ContentAlignment.TopLeft;
313 Assert.AreEqual (ContentAlignment.TopLeft, l.ImageAlign, "I2");
314 l.ImageAlign = ContentAlignment.TopCenter;
315 Assert.AreEqual (ContentAlignment.TopCenter, l.ImageAlign, "I3");
316 l.ImageAlign = ContentAlignment.TopRight;
317 Assert.AreEqual (ContentAlignment.TopRight, l.ImageAlign, "I4");
318 l.ImageAlign = ContentAlignment.MiddleLeft;
319 Assert.AreEqual (ContentAlignment.MiddleLeft, l.ImageAlign, "I5");
320 l.ImageAlign = ContentAlignment.MiddleCenter;
321 Assert.AreEqual (ContentAlignment.MiddleCenter, l.ImageAlign, "I6");
322 l.ImageAlign = ContentAlignment.MiddleRight;
323 Assert.AreEqual (ContentAlignment.MiddleRight, l.ImageAlign, "I7");
324 l.ImageAlign = ContentAlignment.BottomLeft;
325 Assert.AreEqual (ContentAlignment.BottomLeft, l.ImageAlign, "I8");
326 l.ImageAlign = ContentAlignment.BottomCenter;
327 Assert.AreEqual (ContentAlignment.BottomCenter, l.ImageAlign, "I9");
328 l.ImageAlign = ContentAlignment.BottomRight;
329 Assert.AreEqual (ContentAlignment.BottomRight, l.ImageAlign, "I10");
330 Assert.AreEqual (-1, l.ImageIndex, "I11");
331 Assert.AreEqual (null, l.ImageList, "I12");
332 Assert.AreEqual (null, l.Image, "I13");
333 l.Image = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
334 Assert.IsNotNull (l.Image, "I14");
335 bmp = (Bitmap)l.Image;
336 Assert.IsNotNull (bmp.GetPixel (0, 0), "I15");
339 ImageList il = new ImageList ();
340 il.ColorDepth = ColorDepth.Depth32Bit;
341 il.ImageSize = new Size (15, 15);
342 il.Images.Add (Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png"));
346 Assert.AreEqual (0, l.ImageIndex, "I16");
347 Assert.IsNotNull (l.ImageList, "I17");
354 // Assert.AreEqual (false, l.TabStop, "T1");
355 Assert.AreEqual (ContentAlignment.TopLeft, l.TextAlign, "T2");
358 Assert.AreEqual (true, l.UseMnemonic, "U1");
359 l.UseMnemonic = false;
360 Assert.AreEqual (false, l.UseMnemonic, "U2");
365 public void LabelEqualsTest ()
367 Label s1 = new Label ();
368 Label s2 = new Label ();
371 Assert.AreEqual (false, s1.Equals (s2), "E1");
372 Assert.AreEqual (true, s1.Equals (s1), "E2");
376 public void LabelScaleTest ()
378 Label r1 = new Label ();
382 Assert.AreEqual (80, r1.Width, "W1");
383 Assert.AreEqual (40, r1.Height, "H1");
387 public void PubMethodTest ()
389 Label l = new Label ();
393 Assert.AreEqual ("System.Windows.Forms.Label, Text: My Label", l.ToString (), "T1");
399 public class LabelEventTest
401 static bool eventhandled = false;
402 public void Label_EventHandler (object sender,EventArgs e)
408 public void AutoSizeChangedChangedTest ()
410 Form myform = new Form ();
411 myform.Visible = true;
412 Label l = new Label ();
414 myform.Controls.Add (l);
415 l.AutoSizeChanged += new EventHandler (Label_EventHandler);
417 Assert.AreEqual (true, eventhandled, "B4");
418 eventhandled = false;
422 public void BackgroundImageChangedTest ()
424 Form myform = new Form ();
425 myform.Visible = true;
426 Label l = new Label ();
428 myform.Controls.Add (l);
429 l.BackgroundImageChanged += new EventHandler (Label_EventHandler);
430 l.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
431 Assert.AreEqual (true, eventhandled, "B4");
432 eventhandled = false;
436 public void ImeModeChangedTest ()
438 Form myform = new Form ();
439 myform.Visible = true;
440 Label l = new Label ();
442 myform.Controls.Add (l);
443 l.ImeModeChanged += new EventHandler (Label_EventHandler);
444 l.ImeMode = ImeMode.Katakana;
445 Assert.AreEqual (true, eventhandled, "I16");
446 eventhandled = false;
449 [Test, Ignore ("This isnt complete.")]
450 public void KeyDownTest ()
452 Form myform = new Form ();
453 myform.Visible = true;
454 Label l = new Label ();
456 myform.Controls.Add (l);
457 l.KeyDown += new KeyEventHandler (Label_EventHandler);
459 //Assert.AreEqual (true, eventhandled, "K1");
460 eventhandled = false;
464 [Test, Ignore ("This is failing.")]
465 public void TabStopChangedTest ()
467 Form myform = new Form ();
468 myform.Visible = true;
469 Label l = new Label ();
471 myform.Controls.Add (l);
472 l.TabStopChanged += new EventHandler (Label_EventHandler);
474 Assert.AreEqual (true, eventhandled, "T3");
475 eventhandled = false;
479 public void TextAlignChangedTest ()
481 Form myform = new Form ();
482 myform.Visible = true;
483 Label l = new Label ();
485 myform.Controls.Add (l);
486 l.TextAlignChanged += new EventHandler (Label_EventHandler);
487 l.TextAlign = ContentAlignment.TopRight;
488 Assert.AreEqual (true, eventhandled, "T4");
489 eventhandled = false;
493 public class MyLabel : Label
495 private ArrayList results = new ArrayList ();
496 public MyLabel () : base ()
498 // TODO: we need to add those later.
499 //this.HandleCreated += new EventHandler (HandleCreatedHandler);
500 //this.BindingContextChanged += new EventHandler (BindingContextChangedHandler);
501 //this.Invalidated += new InvalidateEventHandler (InvalidatedHandler);
502 //this.Resize += new EventHandler (ResizeHandler);
503 //this.SizeChanged += new EventHandler (SizeChangedHandler);
504 //this.Layout += new LayoutEventHandler (LayoutHandler);
505 //this.VisibleChanged += new EventHandler (VisibleChangedHandler);
506 //this.Paint += new PaintEventHandler (PaintHandler);
509 protected override void OnAutoSizeChanged (EventArgs e)
511 results.Add ("OnAutoSizeChanged");
512 base.OnAutoSizeChanged (e);
515 protected override void OnBackgroundImageChanged (EventArgs e)
517 results.Add ("OnBackgroundImageChanged");
518 base.OnBackgroundImageChanged (e);
521 protected override void OnImeModeChanged (EventArgs e)
523 results.Add ("OnImeModeChanged");
524 base.OnImeModeChanged (e);
527 protected override void OnKeyDown (KeyEventArgs e)
529 results.Add ("OnKeyDown");
533 protected override void OnKeyPress (KeyPressEventArgs e)
535 results.Add ("OnKeyPress");
539 protected override void OnKeyUp (KeyEventArgs e)
541 results.Add ("OnKeyUp");
545 protected override void OnHandleCreated (EventArgs e)
547 results.Add ("OnHandleCreated");
548 base.OnHandleCreated (e);
551 protected override void OnBindingContextChanged (EventArgs e)
553 results.Add ("OnBindingContextChanged");
554 base.OnBindingContextChanged (e);
557 protected override void OnInvalidated (InvalidateEventArgs e)
559 results.Add("OnInvalidated");
560 base.OnInvalidated (e);
563 protected override void OnResize (EventArgs e)
565 results.Add("OnResize");
569 protected override void OnSizeChanged (EventArgs e)
571 results.Add("OnSizeChanged");
572 base.OnSizeChanged (e);
575 protected override void OnLayout (LayoutEventArgs e)
577 results.Add("OnLayout");
581 protected override void OnVisibleChanged (EventArgs e)
583 results.Add("OnVisibleChanged");
584 base.OnVisibleChanged (e);
587 protected override void OnPaint (PaintEventArgs e)
589 results.Add("OnPaint");
593 public void KeyPressA()
599 m.Msg = (int)WndMsg.WM_KEYDOWN;
600 m.HWnd = this.Handle;
601 m.WParam = (IntPtr)0x41;
602 m.LParam = (IntPtr)0x1e0001;
605 m.Msg = (int)WndMsg.WM_CHAR;
606 m.HWnd = this.Handle;
607 m.WParam = (IntPtr)0x61;
608 m.LParam = (IntPtr)0x1e0001;
611 m.Msg = (int)WndMsg.WM_KEYUP;
612 m.HWnd = this.Handle;
613 m.WParam = (IntPtr)0x41;
614 m.LParam = (IntPtr)unchecked((int)0xC01e0001);
618 public void KeyDownA()
624 m.Msg = (int)WndMsg.WM_KEYDOWN;
625 m.HWnd = this.Handle;
626 m.WParam = (IntPtr)0x41;
627 m.LParam = (IntPtr)0x1e0001;
630 m.Msg = (int)WndMsg.WM_CHAR;
631 m.HWnd = this.Handle;
632 m.WParam = (IntPtr)0x61;
633 m.LParam = (IntPtr)0x1e0001;
643 m.Msg = (int)WndMsg.WM_KEYUP;
644 m.HWnd = this.Handle;
645 m.WParam = (IntPtr)0x41;
646 m.LParam = (IntPtr)unchecked((int)0xC01e0001);
650 public ArrayList Results {
651 get { return results; }
656 public class LabelTestEventsOrder
658 public string [] ArrayListToString (ArrayList arrlist)
660 string [] retval = new string [arrlist.Count];
661 for (int i = 0; i < arrlist.Count; i++)
662 retval[i] = (string)arrlist[i];
667 public void CreateEventsOrder ()
669 string[] EventsWanted = {
671 "OnBindingContextChanged",
672 "OnBindingContextChanged"
674 Form myform = new Form ();
675 myform.Visible = true;
676 MyLabel l = new MyLabel ();
677 myform.Controls.Add (l);
679 Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
683 public void SizeChangedEventsOrder ()
685 string[] EventsWanted = {
687 "OnBindingContextChanged",
688 "OnBindingContextChanged",
694 Form myform = new Form ();
695 myform.Visible = true;
696 MyLabel l = new MyLabel ();
697 myform.Controls.Add (l);
698 l.Size = new Size (150, 20);
700 Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
704 public void AutoSizeChangedEventsOrder ()
706 string[] EventsWanted = {
708 "OnBindingContextChanged",
709 "OnBindingContextChanged",
716 Form myform = new Form ();
717 myform.Visible = true;
718 MyLabel l = new MyLabel ();
719 myform.Controls.Add (l);
722 Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
726 public void BackgroundImageChangedEventsOrder ()
728 string[] EventsWanted = {
730 "OnBindingContextChanged",
731 "OnBindingContextChanged",
732 "OnBackgroundImageChanged",
735 Form myform = new Form ();
736 myform.Visible = true;
737 MyLabel l = new MyLabel ();
738 myform.Controls.Add (l);
739 l.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
741 Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
745 public void ImeModeChangedChangedEventsOrder ()
747 string[] EventsWanted = {
749 "OnBindingContextChanged",
750 "OnBindingContextChanged",
753 Form myform = new Form ();
754 myform.Visible = true;
755 MyLabel l = new MyLabel ();
756 myform.Controls.Add (l);
757 l.ImeMode = ImeMode.Katakana;
759 Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
763 public void KeyDownEventsOrder ()
765 string[] EventsWanted = {
767 "OnBindingContextChanged",
768 "OnBindingContextChanged",
772 Form myform = new Form ();
773 myform.Visible = true;
774 MyLabel l = new MyLabel ();
775 myform.Controls.Add (l);
778 Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
782 public void KeyPressEventsOrder ()
784 string[] EventsWanted = {
786 "OnBindingContextChanged",
787 "OnBindingContextChanged",
792 Form myform = new Form ();
793 myform.Visible = true;
794 MyLabel l = new MyLabel ();
795 myform.Controls.Add (l);
798 Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
802 public void KeyUpEventsOrder ()
804 string[] EventsWanted = {
806 "OnBindingContextChanged",
807 "OnBindingContextChanged",
810 Form myform = new Form ();
811 myform.Visible = true;
812 MyLabel l = new MyLabel ();
813 myform.Controls.Add (l);
816 Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
820 public void TabStopChangedEventsOrder ()
822 string[] EventsWanted = {
824 "OnBindingContextChanged",
825 "OnBindingContextChanged"
827 Form myform = new Form ();
828 myform.Visible = true;
829 MyLabel l = new MyLabel ();
830 myform.Controls.Add (l);
833 Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
837 public void TextAlignChangedEventsOrder ()
839 string[] EventsWanted = {
841 "OnBindingContextChanged",
842 "OnBindingContextChanged",
845 Form myform = new Form ();
846 myform.Visible = true;
847 MyLabel l = new MyLabel ();
848 myform.Controls.Add (l);
849 l.TextAlign = ContentAlignment.TopRight;
851 Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));