Author: toshok
Date: 2006-11-15 19:51:58 -0500 (Wed, 15 Nov 2006)
New Revision: 67965

Modified:
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormTest.cs
Log:
add some HandleDestroyed tests (to see if it's generated from RecreateHandle), 
and another check for disposing of a form's owner.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormTest.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormTest.cs 
2006-11-16 00:37:36 UTC (rev 67964)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormTest.cs 
2006-11-16 00:51:58 UTC (rev 67965)
@@ -226,6 +226,7 @@
                        f1.Dispose ();
 
                        Assert.IsNull (f2.Owner, "1");
+                       Assert.AreEqual (0, f1.OwnedForms.Length, "2");
                }
 
                [Test]
@@ -240,7 +241,43 @@
                        myform.Show (); // and this line should result in the 
ODE being thrown
                }
 
+               class MyForm : Form
+               {
+                       public void DoDestroyHandle ()
+                       {
+                               DestroyHandle();
+                       }
+                       public void DoRecreateHandle ()
+                       {
+                               RecreateHandle();
+                       }
+               }
+
+               int handle_destroyed_count;
+               void handle_destroyed (object sender, EventArgs e)
+               {
+                       handle_destroyed_count++;
+               }
+
                [Test]
+               public void DestroyHandleTest ()
+               {
+                       handle_destroyed_count = 0;
+
+                       MyForm f1 = new MyForm ();
+                       f1.HandleDestroyed += new EventHandler 
(handle_destroyed);
+                       f1.Show ();
+                       f1.DoDestroyHandle ();
+                       Assert.AreEqual (1, handle_destroyed_count, "1");
+
+                       f1 = new MyForm ();
+                       f1.HandleDestroyed += new EventHandler 
(handle_destroyed);
+                       f1.Show ();
+                       f1.DoRecreateHandle ();
+                       Assert.AreEqual (2, handle_destroyed_count, "2");
+               }
+
+               [Test]
                public void FormClose ()
                {
                        Form myform = new Form ();

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

Reply via email to