blob: a81d3764894678b832fa1a54edfb145cca462293 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
//
// Copyright (c) 2005 Novell, Inc.
//
// Authors:
// Ritvik Mayank (mritvik@novell.com)
//
using System;
using System.Windows.Forms;
using System.Drawing;
using NUnit.Framework;
namespace MonoTests.System.Windows.Forms
{
[TestFixture]
public class CheckBoxEventTest
{
static bool eventhandled = false;
public void CheckBox_EventHandler (object sender,EventArgs e)
{
eventhandled = true;
}
[Test]
public void ApperanceEventTest ()
{
Form myform = new Form ();
myform.Visible = true;
CheckBox chkbox = new CheckBox ();
chkbox.Visible = true;
myform.Controls.Add (chkbox);
chkbox.AppearanceChanged += new EventHandler (CheckBox_EventHandler);
chkbox.Appearance = Appearance.Button;
Assert.AreEqual (true, eventhandled, "#A1");
}
[Test]
public void CheckedChangedEventTest ()
{
eventhandled = false;
Form myform = new Form ();
myform.Visible = true;
CheckBox chkbox = new CheckBox ();
chkbox.Visible = true;
myform.Controls.Add (chkbox);
chkbox.CheckedChanged += new EventHandler (CheckBox_EventHandler);
chkbox.CheckState = CheckState.Indeterminate;
Assert.AreEqual (true, eventhandled, "#A2");
}
[Test]
public void CheckStateChangedEventTest ()
{
eventhandled = false;
Form myform = new Form ();
myform.Visible = true;
CheckBox chkbox = new CheckBox ();
chkbox.Visible = true;
myform.Controls.Add (chkbox);
chkbox.CheckStateChanged += new EventHandler (CheckBox_EventHandler);
chkbox.CheckState = CheckState.Checked;
Assert.AreEqual (true, eventhandled, "#A3");
}
}
}
|