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