2 // RadioRadioButtonTest.cs: Test cases for RadioRadioButton.
5 // Ritvik Mayank (mritvik@novell.com)
7 // (C) 2005 Novell, Inc. (http://www.novell.com)
11 using System.Windows.Forms;
13 using NUnit.Framework;
15 namespace MonoTests.System.Windows.Forms
18 public class RadioButtonTest
21 public void RadioButtonPropertyTest ()
23 RadioButton rButton1 = new RadioButton ();
26 Assert.AreEqual (Appearance.Normal, rButton1.Appearance, "#A1");
27 Assert.AreEqual (true, rButton1.AutoCheck, "#A2");
30 Assert.AreEqual (false, rButton1.Checked, "#C1");
31 Assert.AreEqual (ContentAlignment.MiddleLeft, rButton1.CheckAlign, "#C2");
34 Assert.AreEqual (null, rButton1.Site, "#S1");
37 rButton1.Text = "New RadioButton";
38 Assert.AreEqual ("New RadioButton", rButton1.Text, "#T1");
39 Assert.AreEqual (ContentAlignment.MiddleLeft, rButton1.TextAlign, "#T2");
43 public void ToStringTest ()
45 RadioButton rButton1 = new RadioButton ();
46 Assert.AreEqual ("System.Windows.Forms.RadioButton, Checked: False" , rButton1.ToString (), "#9");
51 public class RadioButtonEventTestClass
53 static bool eventhandled = false;
54 public static void RadioButton_EventHandler (object sender, EventArgs e)
60 public void PanelClickTest ()
62 Form myForm = new Form ();
63 RadioButton rButton1 = new RadioButton ();
65 rButton1.Visible = true;
66 myForm.Controls.Add (rButton1);
68 rButton1.Click += new EventHandler (RadioButton_EventHandler);
70 rButton1.PerformClick ();
71 Assert.AreEqual (true, eventhandled, "#2");
75 public void ApperanceChangedTest ()
77 Form myForm = new Form ();
78 RadioButton rButton1 = new RadioButton ();
80 rButton1.Visible = true;
81 myForm.Controls.Add (rButton1);
82 rButton1.Appearance = Appearance.Normal;
84 rButton1.AppearanceChanged += new EventHandler (RadioButton_EventHandler);
85 rButton1.Appearance = Appearance.Button;
86 Assert.AreEqual (true, eventhandled, "#2");
90 public void CheckedChangedTest ()
92 Form myForm = new Form ();
93 RadioButton rButton1 = new RadioButton ();
95 rButton1.Visible = true;
96 myForm.Controls.Add (rButton1);
97 rButton1.Checked = false;
99 rButton1.CheckedChanged += new EventHandler (RadioButton_EventHandler);
100 rButton1.Checked = true;
101 Assert.AreEqual (true, eventhandled, "#3");