[MWF] Add unit test for #19818
authorEberhard Beilharz <eb1@sil.org>
Thu, 15 May 2014 15:21:08 +0000 (17:21 +0200)
committerEberhard Beilharz <eb1@sil.org>
Thu, 15 May 2014 15:21:08 +0000 (17:21 +0200)
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs

index 2b0a6a020fe715e94577010424495d7e8ddbb003..96a7c02ef9747ee8d100a4039e07fd8dcc0927af 100644 (file)
@@ -2961,6 +2961,21 @@ namespace MonoTests.System.Windows.Forms
                                Assert.AreEqual (c.ClientRectangle, c.DisplayRectangle);
                        }
                }
+
+               [Test]
+               public void Remove_NoChangeIfNoChild () // #19818
+               {
+                       var c1 = new Control();
+                       var c2 = new Control();
+                       var c3 = new Control();
+
+                       c2.Controls.Add(c3);
+                       c1.Controls.Add(c2);
+                       Assert.AreEqual (c2, c3.Parent);
+
+                       c1.Controls.Remove(c3);
+                       Assert.AreEqual (c2, c3.Parent);
+               }
        }
 
        [TestFixture]