Some simple focus unit tests.
[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
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.Visible = true;
29                         CheckBox chkbox = new CheckBox ();
30                         chkbox.Visible = true;
31                         myform.Controls.Add (chkbox);
32                         chkbox.AppearanceChanged += new EventHandler (CheckBox_EventHandler);
33                         chkbox.Appearance = Appearance.Button;
34                         Assert.AreEqual (true, eventhandled, "#A1");
35                 }
36
37                 [Test]
38                 public void CheckedChangedEventTest ()
39                 {
40                         eventhandled = false;
41                         Form myform = new Form ();
42                         myform.Visible = true;
43                         CheckBox chkbox = new CheckBox ();
44                         chkbox.Visible = true;
45                         myform.Controls.Add (chkbox);
46                         chkbox.CheckedChanged += new EventHandler (CheckBox_EventHandler);
47                         chkbox.CheckState = CheckState.Indeterminate;
48                         Assert.AreEqual (true, eventhandled, "#A2");
49                 }
50
51                 [Test]
52                 public void CheckStateChangedEventTest ()
53                 {
54                         eventhandled = false;
55                         Form myform = new Form ();
56                         myform.Visible = true;
57                         CheckBox chkbox = new CheckBox ();
58                         chkbox.Visible = true;
59                         myform.Controls.Add (chkbox);
60                         chkbox.CheckStateChanged += new EventHandler (CheckBox_EventHandler);
61                         chkbox.CheckState = CheckState.Checked;
62                         Assert.AreEqual (true, eventhandled, "#A3");
63                 }
64         }
65 }