Some simple focus unit tests.
[mono.git] / mcs / class / Managed.Windows.Forms / Test / System.Windows.Forms / CheckedListBoxEventTest.cs
1 //
2 // Copyright (c) 2005 Novell, Inc.
3 //
4 // Authors:
5 //      Ritvik Mayank (mritvik@novell.com)
6 //
7
8 using System;
9 using NUnit.Framework;
10 using System.Windows.Forms;
11 using System.Drawing;
12
13 namespace MonoTests.System.Windows.Forms
14 {
15         [TestFixture]
16         public class CheckedListBoxItemCheckEvent
17         {       
18                 static bool eventhandled = false;
19                 public void ItemCheck_EventHandler (object sender,ItemCheckEventArgs e)
20                 {
21                         eventhandled = true;
22                 }
23
24                 [Test]
25                 public void ItemCheckTest ()
26                 {
27                         Form myform = new Form ();
28                         CheckedListBox mychklstbox = new CheckedListBox ();
29                         mychklstbox.Items.Add ("test1"); 
30                         mychklstbox.Items.Add ("test2"); 
31                         //Test ItemCheck Event
32                         mychklstbox.ItemCheck += new ItemCheckEventHandler (ItemCheck_EventHandler);            
33                         mychklstbox.Items.Add ("test1",CheckState.Checked);
34                         myform.Controls.Add (mychklstbox);
35                         myform.Show ();
36                         Assert.AreEqual (true, eventhandled, "#A1");
37                         eventhandled = false;
38                         mychklstbox.SetItemChecked (1,true);
39                         Assert.AreEqual (true, eventhandled, "#A2");
40                 }
41         }
42 }