Merge pull request #217 from QuickJack/master
[mono.git] / mcs / class / Managed.Windows.Forms / Test / System.Windows.Forms / CheckBoxEventTest.cs
1 //
2 // Copyright (c) 2005 Novell, Inc.
3 //
4 // Authors:
5 //      Ritvik Mayank (mritvik@novell.com)
6 //
7
8 using System;
9 using System.Windows.Forms;
10 using System.Drawing;
11 using NUnit.Framework;
12
13 namespace MonoTests.System.Windows.Forms
14 {
15         [TestFixture]
16         public class CheckBoxEventTest : TestHelper
17         {
18                 static bool eventhandled = false;
19                 public void CheckBox_EventHandler (object sender,EventArgs e)
20                 {
21                         eventhandled = true;
22                 }               
23
24                 [Test]
25                 public void ApperanceEventTest ()
26                 {
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 ();
37                 }
38
39                 [Test]
40                 public void CheckedChangedEventTest ()
41                 {
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 ();
53                 }
54
55                 [Test]
56                 public void CheckStateChangedEventTest ()
57                 {
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 ();
69                 }
70         }
71 }