Author: toshok
Date: 2006-11-04 13:28:28 -0500 (Sat, 04 Nov 2006)
New Revision: 67361

Modified:
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormTest.cs
Log:
        * FormTest.cs: add a few more tests to determine various aspects
        of the Close() method.

2006-11-04  Chris Toshok  <[EMAIL PROTECTED]>



Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2006-11-04 18:03:52 UTC (rev 67360)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2006-11-04 18:28:28 UTC (rev 67361)
@@ -1,5 +1,10 @@
 2006-11-04  Chris Toshok  <[EMAIL PROTECTED]>
 
+       * FormTest.cs: add a few more tests to determine various aspects
+       of the Close() method.
+
+2006-11-04  Chris Toshok  <[EMAIL PROTECTED]>
+
        * FormTest.cs: add a test to more accurately test for bug #79155
        (make sure an ObjectDisposedException is thrown if you Show() a
        Form you just Close()'d).

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-04 18:03:52 UTC (rev 67360)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormTest.cs 
2006-11-04 18:28:28 UTC (rev 67361)
@@ -225,8 +225,63 @@
                        Form myform = new Form ();
                        myform.ShowInTaskbar = false;
 
+                       myform.Show ();
                        myform.Close (); // this should result in the form 
being disposed
                        myform.Show (); // and this line should result in the 
ODE being thrown
                }
+
+               [Test]
+               public void FormClose ()
+               {
+                       Form myform = new Form ();
+                       myform.ShowInTaskbar = false;
+
+                       Assert.IsFalse (myform.Visible, "A1");
+                       Assert.IsFalse (myform.IsDisposed, "A2");
+
+                       myform.Close ();
+
+                       Assert.IsFalse (myform.Visible, "A3");
+                       Assert.IsFalse (myform.IsDisposed, "A4");
+
+                       myform.Show ();
+
+                       Assert.IsTrue (myform.Visible, "A5");
+                       Assert.IsFalse (myform.IsDisposed, "A6");
+
+                       myform.Close ();
+
+                       Assert.IsFalse (myform.Visible, "A7");
+                       Assert.IsTrue (myform.IsDisposed, "A8");
+               }
+
+               [Test]
+               public void FormClose2 ()
+               {
+                       WMCloseWatcher f = new WMCloseWatcher ();
+                       f.ShowInTaskbar = false;
+
+                       f.close_count = 0;
+                       Assert.IsFalse (f.Visible, "A1");
+                       f.Close ();
+                       Assert.AreEqual (0, f.close_count, "A2");
+
+
+                       f.Show ();
+                       f.Close ();
+                       Assert.AreEqual (1, f.close_count, "A3");
+               }
+
+               class WMCloseWatcher : Form {
+                       public int close_count;
+
+                       protected override void WndProc (ref Message msg) {
+                               if (msg.Msg == 0x0010 /* WM_CLOSE */) {
+                                       close_count ++;
+                               }
+
+                               base.WndProc (ref msg);
+                       }
+               }
        }
 }

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

Reply via email to