2007-03-12 Jonathan Pobst <monkey@jpobst.com>
authorJonathan Pobst <monkey@jpobst.com>
Mon, 12 Mar 2007 22:16:35 +0000 (22:16 -0000)
committerJonathan Pobst <monkey@jpobst.com>
Mon, 12 Mar 2007 22:16:35 +0000 (22:16 -0000)
* Control.cs: Another place we don't call SizeFromClientSize.
* Form.cs: Another place we don't call SizeFromClientSize.
[Fixes bug #81125]

2007-03-12  Jonathan Pobst  <monkey@jpobst.com>

* ControlTest.cs: Add test for bug #81125.

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

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs

index ba3e5559201730acc10cd502a9f52f79239d4027..7c503e0e517b53ce019418da27db06adb56733ee 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-12  Jonathan Pobst  <monkey@jpobst.com>
+
+       * Control.cs: Another place we don't call SizeFromClientSize.
+       * Form.cs: Another place we don't call SizeFromClientSize.
+       [Fixes bug #81125]
+
 2007-03-12  Jackson Harper  <jackson@ximian.com>
 
        * TreeView.cs: Basically emulating some strangness here with
index 3185518d0a8d3fb6e3eb5a2e3b3b2edaeea1abc5..d2659a2bdd184a8708fb4dc7c0e9cb9af508bbd8 100644 (file)
@@ -1705,7 +1705,7 @@ namespace System.Windows.Forms
                }
 
                // Sometimes we need to do this calculation without it being virtual (constructor)
-               private Size InternalSizeFromClientSize (Size clientSize)
+               internal Size InternalSizeFromClientSize (Size clientSize)
                {
                        Rectangle ClientRect;
                        Rectangle WindowRect;
@@ -4175,7 +4175,7 @@ namespace System.Windows.Forms
 
                [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected virtual void SetClientSizeCore(int x, int y) {
-                       Size NewSize = SizeFromClientSize (new Size (x, y));
+                       Size NewSize = InternalSizeFromClientSize (new Size (x, y));
                        
                        if (NewSize != Size.Empty)
                                SetBounds (bounds.X, bounds.Y, NewSize.Width, NewSize.Height, BoundsSpecified.Size);
index a70bb9f46f870555a38f37fb0be35f3c6e737906..5dfdc825e9c1b264520e10a3a50517077e503853 100644 (file)
@@ -500,7 +500,7 @@ namespace System.Windows.Forms {
                                
                                if (this.IsHandleCreated) {
                                        UpdateStyles();
-                                       this.Size = SizeFromClientSize (current_client_size);
+                                       this.Size = InternalSizeFromClientSize (current_client_size);
                                }
                        }
                }
index 9706ccb77000318dbbb5f4a7234127f3ef6d6103..b0dc0ca77dd842f0d7abb125addabaf418440136 100644 (file)
@@ -1,3 +1,7 @@
+2007-03-12  Jonathan Pobst  <monkey@jpobst.com>
+
+       * ControlTest.cs: Add test for bug #81125.
+
 2007-03-12  Jonathan Pobst  <monkey@jpobst.com>
 
        * FormTest.cs: Add a test showing we do not recreate the handle when
index 351e881ba9bbd0c642b12fecda90a8d41003689e..f5d0f0a09e0f250922fdc669eb2c37983123f870 100644 (file)
@@ -1565,12 +1565,26 @@ namespace MonoTests.System.Windows.Forms
                }
 
 #if NET_2_0
-               [Test] // bug #80621
-               public void DontCallSizeFromClientSizeInConstructor ()
+               [Test] // bug #80621, #81125
+               public void DontCallSizeFromClientSize ()
                {
                        SizeControl sc = new SizeControl ();
                        
                        Assert.AreEqual (0, sc.size_from_client_size_count, "A1");
+                       
+                       sc.ClientSize = new Size (300, 300);
+                       Assert.AreEqual (0, sc.size_from_client_size_count, "A2");
+                       
+                       SizeForm sf = new SizeForm ();
+                       sf.ShowInTaskbar = false;
+                       sf.Show ();
+                       
+                       Assert.AreEqual (0, sc.size_from_client_size_count, "A3");
+
+                       sc.ClientSize = new Size (300, 300);
+                       Assert.AreEqual (0, sc.size_from_client_size_count, "A4");      
+                       
+                       sf.Dispose ();  
                }
                
                private class SizeControl : Control
@@ -1583,6 +1597,17 @@ namespace MonoTests.System.Windows.Forms
                                return base.SizeFromClientSize (clientSize);
                        }
                }
+
+               private class SizeForm : Form
+               {
+                       public int size_from_client_size_count = 0;
+
+                       protected override Size SizeFromClientSize (Size clientSize)
+                       {
+                               size_from_client_size_count++;
+                               return base.SizeFromClientSize (clientSize);
+                       }
+               }
 #endif
 
                public class MockControl : Control