2007-01-10 Chris Toshok <toshok@ximian.com>
[mono-project.git] / mcs / class / Managed.Windows.Forms / Test / System.Windows.Forms / CheckBoxEventTest.cs
blobbbf09b38684d0ddb3cf66c920aee7d4afff81616
1 //
2 // Copyright (c) 2005 Novell, Inc.
3 //
4 // Authors:
5 // Ritvik Mayank (mritvik@novell.com)
6 //
8 using System;
9 using System.Windows.Forms;
10 using System.Drawing;
11 using NUnit.Framework;
13 namespace MonoTests.System.Windows.Forms
15 [TestFixture]
16 public class CheckBoxEventTest
18 static bool eventhandled = false;
19 public void CheckBox_EventHandler (object sender,EventArgs e)
21 eventhandled = true;
24 [Test]
25 public void ApperanceEventTest ()
27 Form myform = new Form ();
28 myform.ShowInTaskbar = false;
29 myform.Visible = true;
30 CheckBox chkbox = new CheckBox ();
31 chkbox.Visible = true;
32 myform.Controls.Add (chkbox);
33 chkbox.AppearanceChanged += new EventHandler (CheckBox_EventHandler);
34 chkbox.Appearance = Appearance.Button;
35 Assert.AreEqual (true, eventhandled, "#A1");
36 myform.Dispose ();
39 [Test]
40 public void CheckedChangedEventTest ()
42 Form myform = new Form ();
43 myform.ShowInTaskbar = false;
44 eventhandled = false;
45 myform.Visible = true;
46 CheckBox chkbox = new CheckBox ();
47 chkbox.Visible = true;
48 myform.Controls.Add (chkbox);
49 chkbox.CheckedChanged += new EventHandler (CheckBox_EventHandler);
50 chkbox.CheckState = CheckState.Indeterminate;
51 Assert.AreEqual (true, eventhandled, "#A2");
52 myform.Dispose ();
55 [Test]
56 public void CheckStateChangedEventTest ()
58 Form myform = new Form ();
59 myform.ShowInTaskbar = false;
60 eventhandled = false;
61 myform.Visible = true;
62 CheckBox chkbox = new CheckBox ();
63 chkbox.Visible = true;
64 myform.Controls.Add (chkbox);
65 chkbox.CheckStateChanged += new EventHandler (CheckBox_EventHandler);
66 chkbox.CheckState = CheckState.Checked;
67 Assert.AreEqual (true, eventhandled, "#A3");
68 myform.Dispose ();