Author: rolf
Date: 2007-01-16 11:57:50 -0500 (Tue, 16 Jan 2007)
New Revision: 71152

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MdiFormTest.cs
Log:
In Test/System.Windows.Forms:
2007-01-16  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>

        * MdiFormTest.cs: Added tests for ActiveChild for mdi parents.

In System.Windows.Forms:
        * MdiClient.cs: Update main form's ActiveChild when
        activating a mdi child.

2007-01-16  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-01-16 16:52:52 UTC (rev 71151)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-01-16 16:57:50 UTC (rev 71152)
@@ -11,6 +11,11 @@
 
 2007-01-16  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
 
+       * MdiClient.cs: Update main form's ActiveChild when
+       activating a mdi child.
+
+2007-01-16  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
+
        * MdiWindowManager.cs: Fix NRE when merging menus and main form
        doesn't have a menu.
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs     
2007-01-16 16:52:52 UTC (rev 71151)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs     
2007-01-16 16:57:50 UTC (rev 71152)
@@ -683,6 +683,7 @@
                                XplatUI.InvalidateNC (form.Handle);
                        }
                        active_child = (Form) Controls [0];
+                       ParentForm.ActiveControl = active_child;
                }
 
                internal override IntPtr AfterTopMostControl ()

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-01-16 16:52:52 UTC (rev 71151)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-01-16 16:57:50 UTC (rev 71152)
@@ -1,3 +1,7 @@
+2007-01-16  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
+
+       * MdiFormTest.cs: Added tests for ActiveChild for mdi parents.
+
 2007-01-15  Everaldo Canuto  <[EMAIL PROTECTED]>
 
        * MenuTest.cs: Add test for #80006, mainmenu merge operations.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MdiFormTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MdiFormTest.cs  
    2007-01-16 16:52:52 UTC (rev 71151)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MdiFormTest.cs  
    2007-01-16 16:57:50 UTC (rev 71152)
@@ -45,12 +45,20 @@
                // each test directly, not by nunit.
                public void SetUp (bool only_create, bool only_text)
                {
+                       SetUp (only_create, only_text, false);
+               }
+
+               // No attribute here since this is supposed to be called from 
+               // each test directly, not by nunit.
+               public void SetUp (bool only_create, bool only_text, bool 
set_parent)
+               {
                        TearDown ();
+                       
                        main = new Form ();
                        child1 = new Form ();
                        child2 = new Form ();
                        child3 = new Form ();
-                       
+
                        if (only_create)
                                return;
 
@@ -58,13 +66,78 @@
                        child1.Text = child1.Name = "child1";
                        child2.Text = child2.Name = "child2";
                        child3.Text = child3.Name = "child3";
-                       
+
                        if (only_text)
                                return;
 
                        main.IsMdiContainer = true;
+                       
+                       if (set_parent) {
+                               child1.MdiParent = main;
+                               child2.MdiParent = main;
+                               child3.MdiParent = main;
+                       }
                }
+               
+               [Test]
+               public void ActiveControlTest ()
+               {
+                       SetUp (false, false, true);
+                       
+                       main.Show ();
+                       
+                       Assert.IsNull (main.ActiveControl, "#01");              
        
+                       child1.Visible = true;
+                       Assert.AreSame (child1, main.ActiveControl, "#02");
+                       child2.Visible = true;
+                       Assert.AreSame (child2, main.ActiveControl, "#03");
+                       child3.Visible = true;
+                       Assert.AreSame (child3, main.ActiveControl, "#04");
+                       TearDown ();
+               }
+               
+               [Test]
+               public void SelectNextControlTest ()
+               {
+                       SetUp (false, false, true);
 
+                       main.Show ();
+                       
+                       child1.Visible = true;
+                       child2.Visible = true;
+                       child3.Visible = true;
+                       
+                       main.SelectNextControl (main.ActiveControl, true, 
false, true, true);
+                       Assert.AreSame (child1, main.ActiveControl, "#01");
+                       main.SelectNextControl (main.ActiveControl, true, 
false, true, true);
+                       Assert.AreSame (child2, main.ActiveControl, "#02");
+                       main.SelectNextControl (main.ActiveControl, true, 
false, true, true);
+                       Assert.AreSame (child3, main.ActiveControl, "#03");
+                                               
+                       TearDown ();
+               }
+
+               [Test]
+               public void SelectPreviousControlTest ()
+               {
+                       SetUp (false, false, true);
+
+                       main.Show ();
+                       
+                       child1.Visible = true;
+                       child2.Visible = true;
+                       child3.Visible = true;
+
+                       main.SelectNextControl (main.ActiveControl, false, 
false, true, true);
+                       Assert.AreSame (child2, main.ActiveControl, "#01");
+                       main.SelectNextControl (main.ActiveControl, false, 
false, true, true);
+                       Assert.AreSame (child1, main.ActiveControl, "#02");
+                       main.SelectNextControl (main.ActiveControl, false, 
false, true, true);
+                       Assert.AreSame (child3, main.ActiveControl, "#03");
+
+                       TearDown ();
+               }
+               
                [Category("NotWorking")]
                [Test]
                public void StartLocationTest1 ()

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to