Author: toshok
Date: 2006-12-11 15:00:28 -0500 (Mon, 11 Dec 2006)
New Revision: 69355

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs
Log:
In System.Windows.Forms:
2006-12-11  Chris Toshok  <[EMAIL PROTECTED]>

        * Control.cs: ControlCollection.Remove should return if the arg is
        null, and ControlCollection.SetChildIndex should raise a ANE.

In Test/System.Windows.Forms:
2006-12-11  Chris Toshok  <[EMAIL PROTECTED]>

        * ControlTest.cs: add some unit tests for null parameters to some
        of the ControlCollection methods.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-12-11 19:53:27 UTC (rev 69354)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-12-11 20:00:28 UTC (rev 69355)
@@ -1,3 +1,8 @@
+2006-12-11  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * Control.cs: ControlCollection.Remove should return if the arg is
+       null, and ControlCollection.SetChildIndex should raise a ANE.
+
 2006-12-11  Gert Driesen  <[EMAIL PROTECTED]>
 
        * Control.cs: Verify value set for Dock property. Code formatting

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-12-11 19:53:27 UTC (rev 69354)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-12-11 20:00:28 UTC (rev 69355)
@@ -539,6 +539,9 @@
                        }
 
                        public virtual void Remove(Control value) {
+                               if (value == null)
+                                       return;
+
                                owner.PerformLayout(value, "Parent");
                                owner.OnControlRemoved(new 
ControlEventArgs(value));
 
@@ -570,6 +573,9 @@
                        }
 
                        public void SetChildIndex(Control child, int newIndex) {
+                               if (child == null)
+                                       throw new ArgumentNullException 
("child");
+
                                int     old_index;
 
                                old_index=list.IndexOf(child);

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-11 19:53:27 UTC (rev 69354)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2006-12-11 20:00:28 UTC (rev 69355)
@@ -1,3 +1,8 @@
+2006-12-11  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * ControlTest.cs: add some unit tests for null parameters to some
+       of the ControlCollection methods.
+
 2006-12-11  Gert Driesen  <[EMAIL PROTECTED]>
 
        * ControlTest.cs: Added test for invalid Dock value.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs  
    2006-12-11 19:53:27 UTC (rev 69354)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs  
    2006-12-11 20:00:28 UTC (rev 69355)
@@ -969,6 +969,47 @@
                        grandma.Enabled = false;
                        Assert.AreEqual(3, EnabledCalledCount, "Child Enabled 
Event not properly fired");
                }
+
+               [Test]
+               public void ControlsRemoveNullTest ()
+               {
+                       Control c = new Control ();
+                       c.Controls.Remove (null);
+               }
+
+               [Test]
+               public void ControlsAddNullTest ()
+               {
+                       Control c = new Control ();
+                       c.Controls.Add (null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void ControlsSetChildIndexNullTest ()
+               {
+                       Control c = new Control ();
+                       c.Controls.SetChildIndex (null, 1);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void ControlsAddRangeNullTest ()
+               {
+                       Control c = new Control ();
+                       c.Controls.AddRange (null);
+               }
+
+               [Test]
+               public void ControlsAddRangeNullElementTest ()
+               {
+                       Control c = new Control ();
+                       Control[] subcontrols = new Control[2];
+                       subcontrols[0] = new Control ();
+                       subcontrols[1] = null;
+
+                       c.Controls.AddRange (subcontrols);
+               }
        }
 
        [TestFixture]

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

Reply via email to