2008-07-15 Jonathan Pobst <monkey@jpobst.com>
authorJonathan Pobst <monkey@jpobst.com>
Tue, 15 Jul 2008 14:58:52 +0000 (14:58 -0000)
committerJonathan Pobst <monkey@jpobst.com>
Tue, 15 Jul 2008 14:58:52 +0000 (14:58 -0000)
* ImageList.cs: Fix ICollection.CopyTo implementation for
ImageListCollection.  [Fixes bug #409169]

2008-07-15  Jonathan Pobst  <monkey@jpobst.com>

* ImageListTest.cs: Add test for bug #409169.

svn path=/trunk/mcs/; revision=107967

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageList.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ImageListTest.cs

index a8303c5fc5fc466f7cb04c0c838b1e464d497e02..c0d68ef4b130e4407f68d44033eacb36e68f7d28 100644 (file)
@@ -1,3 +1,8 @@
+2008-07-15  Jonathan Pobst  <monkey@jpobst.com>
+
+       * ImageList.cs: Fix ICollection.CopyTo implementation for
+       ImageListCollection.  [Fixes bug #409169]
+
 2008-07-14  Jonathan Pobst  <monkey@jpobst.com>
 
        * MenuAPI.cs, ToolStripDropDown.cs: Use VirtualScreen instead of
index 5956468450d1b203baa4be6877b5824ec072bf89..c78bd9c8c0a28a2f8b93d18b3a436c56d5f61aa3 100644 (file)
@@ -949,8 +949,7 @@ namespace System.Windows.Forms
 
                        void ICollection.CopyTo(Array dest, int index)
                        {
-                               for (int imageIndex = 0; imageIndex < this.Count; imageIndex++)
-                                       dest.SetValue (this [index], index++);
+                               list.CopyTo (dest, index);
                        }
                        #endregion // ImageCollection Interface Methods
                }
index e4e083812d90155f590735d1eb20f6563b58bc00..6e2ef1ff1edb0ab3443533e7b328e9156c2ec7ea 100644 (file)
@@ -1,3 +1,7 @@
+2008-07-15  Jonathan Pobst  <monkey@jpobst.com>
+
+       * ImageListTest.cs: Add test for bug #409169.
+
 2008-07-14  Jonathan Pobst  <monkey@jpobst.com>
 
        * TreeViewTest.cs: Add test for bug #409029.
index 3e8982e5b38b86706cf35590643001bdd6423ab8..96c3cb0a93196d571dbc6f92e356571864982957 100644 (file)
@@ -14,6 +14,7 @@ using System.Reflection;
 using System.ComponentModel;
 using NUnit.Framework;
 using System.Threading;
+using System.Collections;
 
 
 namespace MonoTests.System.Windows.Forms
@@ -169,6 +170,21 @@ namespace MonoTests.System.Windows.Forms
                                         myimagelist.ToString (), "#T3");
                }
                
+               [Test]
+               public void Bug409169 ()
+               {
+                       ImageList imgList = new ImageList ();
+                       ImageList.ImageCollection coll = imgList.Images;
+                       Bitmap img1 = new Bitmap (10, 10);
+                       coll.Add (img1);
+
+                       const int dstOffset = 5;
+                       object[] dst = new object[dstOffset + coll.Count];
+                       ((IList)coll).CopyTo (dst, dstOffset);
+                       
+                       Assert.IsNotNull (dst[dstOffset], "A1");
+               }
+               
                [TestFixture]
                public class ImageListRecreateHandleEventClass
                {