[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-patches
Subject: [Mono-patches] r70278 -
From: "Gert Driesen (gert.driesen () pandora ! be)"
Date: 2006-12-31 10:12:44
Message-ID: 20061231101244.289E39472C () mono-cvs ! ximian ! com
[Download RAW message or body]
Author: gert
Date: 2006-12-31 05:12:43 -0500 (Sun, 31 Dec 2006)
New Revision: 70278
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ContainerControlTest.cs
Log:
* ContainerControlTest.cs: Added tests for ActiveControl.
Modified: trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog 2006-12-31 \
04:11:33 UTC (rev 70277)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog 2006-12-31 \
10:12:43 UTC (rev 70278) @@ -1,3 +1,7 @@
+2006-12-30 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * ContainerControlTest.cs: Added tests for ActiveControl.
+
2006-12-30 Chris Toshok <toshok@ximian.com>
* DefaultLayoutTest.cs: add some more variants for the test for
Modified: trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ContainerControlTest.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ContainerControlTest.cs 2006-12-31 \
04:11:33 UTC (rev 70277)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ContainerControlTest.cs 2006-12-31 \
10:12:43 UTC (rev 70278) @@ -72,5 +72,195 @@
b.Parent = cct;
Assert.IsNull (b.GetContainerControl (), "Button.GetContainerControl/without \
parent"); }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void ActiveControl ()
+ {
+ ContainerControl cc = new ContainerControl ();
+ Control c1 = new Control ();
+ cc.Controls.Add (c1);
+ Control c2 = new Control ();
+ cc.Controls.Add (c2);
+ Control c3 = new Control ();
+ cc.Controls.Add (c3);
+ Assert.IsFalse (c1.Focused, "#A1");
+ Assert.IsFalse (c2.Focused, "#A2");
+ Assert.IsFalse (c3.Focused, "#A3");
+ Assert.IsNull (cc.ActiveControl);
+
+ cc.ActiveControl = c1;
+ Assert.IsFalse (c1.Focused, "#B1");
+ Assert.IsFalse (c2.Focused, "#B2");
+ Assert.IsFalse (c3.Focused, "#B3");
+ Assert.AreSame (c1, cc.ActiveControl, "#B4");
+
+ cc.ActiveControl = c2;
+ Assert.IsFalse (c1.Focused, "#C1");
+ Assert.IsFalse (c2.Focused, "#C2");
+ Assert.IsFalse (c3.Focused, "#C3");
+ Assert.AreSame (c2, cc.ActiveControl, "#C4");
+
+ c1.Focus ();
+ Assert.IsFalse (c1.Focused, "#D1");
+ Assert.IsFalse (c2.Focused, "#D2");
+ Assert.IsFalse (c3.Focused, "#D3");
+ Assert.AreSame (c2, cc.ActiveControl, "#D4");
+
+ cc.ActiveControl = c2;
+ Assert.IsFalse (c1.Focused, "#E1");
+ Assert.IsFalse (c2.Focused, "#E2");
+ Assert.IsFalse (c3.Focused, "#E3");
+ Assert.AreSame (c2, cc.ActiveControl, "#E4");
+
+ cc.Controls.Remove (c2);
+ Assert.IsFalse (c1.Focused, "#F1");
+ Assert.IsFalse (c2.Focused, "#F2");
+ Assert.IsFalse (c3.Focused, "#F3");
+ Assert.AreSame (c1, cc.ActiveControl, "#F3");
+
+ cc.ActiveControl = c3;
+ Assert.IsFalse (c1.Focused, "#G1");
+ Assert.IsFalse (c2.Focused, "#G2");
+ Assert.IsFalse (c3.Focused, "#G3");
+ Assert.AreSame (c3, cc.ActiveControl, "#G4");
+
+ Form form = new Form ();
+ form.ShowInTaskbar = false;
+ form.Controls.Add (cc);
+ form.Show ();
+
+ Assert.IsTrue (c1.Focused, "#H1");
+ Assert.IsFalse (c2.Focused, "#H2");
+ Assert.IsFalse (c3.Focused, "#H3");
+ Assert.AreSame (c1, cc.ActiveControl, "#H4");
+
+ cc.ActiveControl = c3;
+ Assert.IsFalse (c1.Focused, "#I1");
+ Assert.IsFalse (c2.Focused, "#I2");
+ Assert.IsTrue (c3.Focused, "#I3");
+ Assert.AreSame (c3, cc.ActiveControl, "#I4");
+
+ c1.Focus ();
+ Assert.IsTrue (c1.Focused, "#J1");
+ Assert.IsFalse (c2.Focused, "#J2");
+ Assert.IsFalse (c3.Focused, "#J3");
+ Assert.AreSame (c1, cc.ActiveControl, "#J4");
+ }
+
+ [Test] // bug #80411
+ [Category ("NotWorking")]
+ public void ActiveControl_NoChild ()
+ {
+ ContainerControl cc = new ContainerControl ();
+ try {
+ cc.ActiveControl = new Control ();
+ Assert.Fail ("#1");
+ } catch (ArgumentException ex) {
+ Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+ Assert.IsNotNull (ex.Message, "#3");
+ Assert.IsNull (ex.ParamName, "#4");
+ Assert.IsNull (ex.InnerException, "#5");
+ }
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void ActiveControl_Invisible ()
+ {
+ ContainerControl cc = new ContainerControl ();
+ Control c1 = new Control ();
+ c1.Visible = false;
+ cc.Controls.Add (c1);
+ Control c2 = new Control ();
+ cc.Controls.Add (c2);
+ cc.ActiveControl = c1;
+ Assert.IsFalse (c1.Focused, "#A1");
+ Assert.IsFalse (c2.Focused, "#A2");
+ Assert.AreSame (c1, cc.ActiveControl, "#A3");
+
+ Form form = new Form ();
+ form.ShowInTaskbar = false;
+ form.Controls.Add (cc);
+ form.Show ();
+
+ Assert.IsFalse (c1.Focused, "#B1");
+ Assert.IsTrue (c2.Focused, "#B2");
+ Assert.AreSame (c2, cc.ActiveControl, "#B3");
+
+ cc.ActiveControl = c1;
+ Assert.IsFalse (c1.Focused, "#C1");
+ Assert.IsFalse (c2.Focused, "#C2");
+ Assert.AreSame (c1, cc.ActiveControl, "#C3");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void ActiveControl_Disabled ()
+ {
+ ContainerControl cc = new ContainerControl ();
+ Control c1 = new Control ();
+ c1.Enabled = false;
+ cc.Controls.Add (c1);
+ Control c2 = new Control ();
+ cc.Controls.Add (c2);
+ cc.ActiveControl = c1;
+ Assert.IsFalse (c1.Focused, "#A1");
+ Assert.IsFalse (c2.Focused, "#A2");
+ Assert.AreSame (c1, cc.ActiveControl, "#A3");
+
+ Form form = new Form ();
+ form.ShowInTaskbar = false;
+ form.Controls.Add (cc);
+ form.Show ();
+
+ Assert.IsFalse (c1.Focused, "#B1");
+ Assert.IsTrue (c2.Focused, "#B2");
+ Assert.AreSame (c2, cc.ActiveControl, "#B3");
+
+ cc.ActiveControl = c1;
+ Assert.IsFalse (c1.Focused, "#C1");
+ Assert.IsTrue (c2.Focused, "#C2");
+ Assert.AreSame (c1, cc.ActiveControl, "#C3");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void ActiveControl_Null ()
+ {
+ ContainerControl cc = new ContainerControl ();
+ Control c1 = new Control ();
+ cc.Controls.Add (c1);
+ Control c2 = new Control ();
+ cc.Controls.Add (c2);
+ cc.ActiveControl = c1;
+ Assert.IsFalse (c1.Focused, "#A1");
+ Assert.IsFalse (c2.Focused, "#A2");
+ Assert.AreSame (c1, cc.ActiveControl, "#A3");
+
+ cc.ActiveControl = null;
+ Assert.IsFalse (c1.Focused, "#B1");
+ Assert.IsFalse (c2.Focused, "#B2");
+ Assert.IsNull (cc.ActiveControl, "#B3");
+
+ Form form = new Form ();
+ form.ShowInTaskbar = false;
+ form.Controls.Add (cc);
+ form.Show ();
+
+ Assert.IsTrue (c1.Focused, "#C1");
+ Assert.IsFalse (c2.Focused, "#C2");
+ Assert.AreSame (c1, cc.ActiveControl, "#C3");
+
+ cc.ActiveControl = c2;
+ Assert.IsFalse (c1.Focused, "#D1");
+ Assert.IsTrue (c2.Focused, "#D2");
+ Assert.AreSame (c2, cc.ActiveControl, "#D3");
+
+ cc.ActiveControl = null;
+ Assert.IsFalse (c1.Focused, "#E1");
+ Assert.IsFalse (c2.Focused, "#E2");
+ Assert.IsNull (cc.ActiveControl, "#E3");
+ }
}
}
_______________________________________________
Mono-patches maillist - Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic