Author: jpobst
Date: 2007-09-11 13:10:47 -0400 (Tue, 11 Sep 2007)
New Revision: 85647

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollBarTest.cs
Log:
2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>

        * ScrollBar.cs: Fix an issue reported on the lists where setting a 
scrollbar's
        Maximum to lower that its current Value caused an ArgumentException by 
setting
        the Value to the new Maximum.

2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>

        * ScrollBarTest.cs: Add test demonstrating behavior when Maximum
        is set lower than Value.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-09-11 17:07:38 UTC (rev 85646)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-09-11 17:10:47 UTC (rev 85647)
@@ -1,5 +1,11 @@
 2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>
 
+       * ScrollBar.cs: Fix an issue reported on the lists where setting a 
scrollbar's
+       Maximum to lower that its current Value caused an ArgumentException by 
setting
+       the Value to the new Maximum.
+
+2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>
+
        * ThemeWin32Classic.cs: Math is hard!  Fix some math so that the 
TrackBar
        handle moves to the closest tick when it is being dragged.
        [Fixes bug #82751]

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs     
2007-09-11 17:07:38 UTC (rev 85646)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs     
2007-09-11 17:10:47 UTC (rev 85647)
@@ -426,7 +426,9 @@
 
                                if (maximum < minimum)
                                        minimum = maximum;
-
+                               if (Value > maximum)
+                                       Value = maximum;
+                                       
                                // thumb area depends on maximum value,
                                // so we need to recalculate it.
                                CalcThumbArea ();

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-09-11 17:07:38 UTC (rev 85646)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-09-11 17:10:47 UTC (rev 85647)
@@ -1,5 +1,10 @@
 2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>
 
+       * ScrollBarTest.cs: Add test demonstrating behavior when Maximum
+       is set lower than Value.
+
+2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>
+
        * DefaultLayoutTest.cs: Add test for bug #82762.
 
 2007-09-06  Jonathan Pobst  <[EMAIL PROTECTED]>

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollBarTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollBarTest.cs
    2007-09-11 17:07:38 UTC (rev 85646)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollBarTest.cs
    2007-09-11 17:10:47 UTC (rev 85647)
@@ -452,6 +452,21 @@
                                return base.GetScaledBounds (bounds, factor, 
specified);
                        }
                }
+               
+               [Test]
+               public void MaximumValueTest ()
+               {
+                       ScrollBar s = new VScrollBar ();
+
+                       s.LargeChange = 0;
+                       s.Maximum = 100;
+                       s.Value = 20;
+                       s.Maximum = 0;
+
+                       Assert.AreEqual (0, s.LargeChange, "A1");
+                       Assert.AreEqual (0, s.Maximum, "A2");
+                       Assert.AreEqual (0, s.Value, "A3");
+               }
 #endif
     }
 

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

Reply via email to