Browse Source

Removed nullable from ContentSize

Tig 1 year ago
parent
commit
a5eca55f29

+ 1 - 1
Terminal.Gui/View/Layout/PosDim.cs

@@ -972,7 +972,7 @@ public class Dim
             {
                 if (us._contentSize is { })
                 {
-                    subviewsSize = dimension == Dimension.Width ? us.ContentSize!.Value.Width : us.ContentSize!.Value.Height;
+                    subviewsSize = dimension == Dimension.Width ? us.ContentSize.Width : us.ContentSize.Height;
                 }
                 else
                 {

+ 17 - 21
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -105,7 +105,7 @@ public partial class View
 
         if (!TextFormatter.AutoSize)
         {
-            TextFormatter.Size = ContentSize.GetValueOrDefault ();
+            TextFormatter.Size = ContentSize;
         }
     }
 
@@ -665,7 +665,7 @@ public partial class View
 
         CheckDimAuto ();
 
-        var contentSize = ContentSize.GetValueOrDefault ();
+        var contentSize = ContentSize;
         OnLayoutStarted (new (contentSize));
 
         LayoutAdornments ();
@@ -689,7 +689,7 @@ public partial class View
         {
             foreach ((View from, View to) in edges)
             {
-                LayoutSubview (to, from.ContentSize.GetValueOrDefault ());
+                LayoutSubview (to, from.ContentSize);
             }
         }
 
@@ -739,15 +739,16 @@ public partial class View
         // TODO: Identify a real-world use-case where this API should be virtual. 
         // TODO: Until then leave it `internal` and non-virtual
 
-        // First try SuperView.Viewport, then Application.Top, then Driver.Viewport.
-        // Finally, if none of those are valid, use int.MaxValue (for Unit tests).
-        Size? contentSize = SuperView is { IsInitialized: true } ? SuperView.ContentSize :
+        // Determine our container's ContentSize - 
+        //  First try SuperView.Viewport, then Application.Top, then Driver.Viewport.
+        //  Finally, if none of those are valid, use int.MaxValue (for Unit tests).
+        Size superViewContentSize = SuperView is { IsInitialized: true } ? SuperView.ContentSize :
                            Application.Top is { } && Application.Top != this && Application.Top.IsInitialized ? Application.Top.ContentSize :
                            Application.Driver?.Screen.Size ?? new (int.MaxValue, int.MaxValue);
 
         SetTextFormatterSize ();
 
-        SetRelativeLayout (contentSize.GetValueOrDefault ());
+        SetRelativeLayout (superViewContentSize);
 
         if (IsInitialized)
         {
@@ -798,41 +799,36 @@ public partial class View
     /// <param name="superviewContentSize">
     ///     The size of the SuperView's content (nominally the same as <c>this.SuperView.ContentSize</c>).
     /// </param>
-    internal void SetRelativeLayout (Size? superviewContentSize)
+    internal void SetRelativeLayout (Size superviewContentSize)
     {
         Debug.Assert (_x is { });
         Debug.Assert (_y is { });
         Debug.Assert (_width is { });
         Debug.Assert (_height is { });
 
-        if (superviewContentSize is null)
-        {
-            return;
-        }
-
         CheckDimAuto ();
         int newX, newW, newY, newH;
 
         if (_width is Dim.DimAuto)
         {
-            newW = _width.Calculate (0, superviewContentSize.Value.Width, this, Dim.Dimension.Width);
-            newX = _x.Calculate (superviewContentSize.Value.Width, newW, this, Dim.Dimension.Width);
+            newW = _width.Calculate (0, superviewContentSize.Width, this, Dim.Dimension.Width);
+            newX = _x.Calculate (superviewContentSize.Width, newW, this, Dim.Dimension.Width);
         }
         else
         {
-            newX = _x.Calculate (superviewContentSize.Value.Width, _width, this, Dim.Dimension.Width);
-            newW = _width.Calculate (newX, superviewContentSize.Value.Width, this, Dim.Dimension.Width);
+            newX = _x.Calculate (superviewContentSize.Width, _width, this, Dim.Dimension.Width);
+            newW = _width.Calculate (newX, superviewContentSize.Width, this, Dim.Dimension.Width);
         }
 
         if (_height is Dim.DimAuto)
         {
-            newH = _height.Calculate (0, superviewContentSize.Value.Height, this, Dim.Dimension.Height);
-            newY = _y.Calculate (superviewContentSize.Value.Height, newH, this, Dim.Dimension.Height);
+            newH = _height.Calculate (0, superviewContentSize.Height, this, Dim.Dimension.Height);
+            newY = _y.Calculate (superviewContentSize.Height, newH, this, Dim.Dimension.Height);
         }
         else
         {
-            newY = _y.Calculate (superviewContentSize.Value.Height, _height, this, Dim.Dimension.Height);
-            newH = _height.Calculate (newY, superviewContentSize.Value.Height, this, Dim.Dimension.Height);
+            newY = _y.Calculate (superviewContentSize.Height, _height, this, Dim.Dimension.Height);
+            newH = _height.Calculate (newY, superviewContentSize.Height, this, Dim.Dimension.Height);
         }
 
         Rectangle newFrame = new (newX, newY, newW, newH);

+ 11 - 37
Terminal.Gui/View/ViewContent.cs

@@ -153,7 +153,7 @@ public partial class View
     /// </param>
     public void SetContentSize (Size? contentSize)
     {
-        if (contentSize?.Width < 0 || contentSize?.Height < 0)
+        if (ContentSize.Width < 0 || ContentSize.Height < 0)
         {
             throw new ArgumentException (@"ContentSize cannot be negative.", nameof (contentSize));
         }
@@ -168,47 +168,21 @@ public partial class View
     }
 
     /// <summary>
-    ///     Gets or sets the size of the View's content.
+    ///     Gets the size of the View's content.
     /// </summary>
     /// <remarks>
     ///     <para>
-    ///         If set to <see langword="null"/>, the value will be the same as the size of <see cref="Viewport"/>,
-    ///         and <c>Viewport.Location</c> will always be <c>0, 0</c>.
+    ///         Use <see cref="SetContentSize"/> to change to change the content size.
     ///     </para>
     ///     <para>
-    ///         If explicitly set, <see cref="Viewport"/> describes the portion of the content currently visible
-    ///         to the view. This enables virtual scrolling.
-    ///     </para>
-    ///     <para>
-    ///         If explicitly set, the behavior of <see cref="Dim.DimAutoStyle.Content"/> will be to use the ContentSize
-    ///         to determine the size of the view.
-    ///     </para>
-    ///     <para>
-    ///         Negative sizes are not supported.
+    ///         If the content size has not been explicitly set with <see cref="SetContentSize"/>, the value tracks
+    ///         <see cref="Viewport"/>.
     ///     </para>
     /// </remarks>
-    public Size? ContentSize
-    {
-        get => _contentSize ?? Viewport.Size;
-        //set
-        //{
-        //    if (value?.Width < 0 || value?.Height < 0)
-        //    {
-        //        throw new ArgumentException (@"ContentSize cannot be negative.", nameof (value));
-        //    }
-
-        //    if (value == _contentSize)
-        //    {
-        //        return;
-        //    }
-
-        //    _contentSize = value;
-        //    OnContentSizeChanged (new (_contentSize));
-        //}
-    }
+    public Size ContentSize => _contentSize ?? Viewport.Size;
 
     /// <summary>
-    ///     Called when <see cref="ContentSize"/> changes. Invokes the <see cref="ContentSizeChanged"/> event.
+    /// Called when <see cref="ContentSize"/> has changed.
     /// </summary>
     /// <param name="e"></param>
     /// <returns></returns>
@@ -441,9 +415,9 @@ public partial class View
         {
             if (!ViewportSettings.HasFlag (ViewportSettings.AllowXGreaterThanContentWidth))
             {
-                if (newViewport.X >= ContentSize.GetValueOrDefault ().Width)
+                if (newViewport.X >= ContentSize.Width)
                 {
-                    newViewport.X = ContentSize.GetValueOrDefault ().Width - 1;
+                    newViewport.X = ContentSize.Width - 1;
                 }
             }
 
@@ -458,9 +432,9 @@ public partial class View
 
             if (!ViewportSettings.HasFlag (ViewportSettings.AllowYGreaterThanContentHeight))
             {
-                if (newViewport.Y >= ContentSize.GetValueOrDefault().Height)
+                if (newViewport.Y >= ContentSize.Height)
                 {
-                    newViewport.Y = ContentSize.GetValueOrDefault ().Height - 1;
+                    newViewport.Y = ContentSize.Height - 1;
                 }
             }
 

+ 3 - 3
Terminal.Gui/View/ViewDrawing.cs

@@ -106,7 +106,7 @@ public partial class View
 
         if (ViewportSettings.HasFlag (ViewportSettings.ClearContentOnly))
         {
-            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), ContentSize.GetValueOrDefault ()));
+            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), ContentSize));
             toClear = Rectangle.Intersect (toClear, visibleContent);
         }
 
@@ -172,7 +172,7 @@ public partial class View
         if (ViewportSettings.HasFlag (ViewportSettings.ClipContentOnly))
         {
             // Clamp the Clip to the just content area that is within the viewport
-            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), ContentSize.GetValueOrDefault ()));
+            Rectangle visibleContent = ViewportToScreen (new Rectangle (new (-Viewport.X, -Viewport.Y), ContentSize));
             clip = Rectangle.Intersect (clip, visibleContent);
         }
 
@@ -475,7 +475,7 @@ public partial class View
 
             // This should NOT clear 
             // TODO: If the output is not in the Viewport, do nothing
-            var drawRect = new Rectangle (ContentToScreen (Point.Empty), ContentSize.GetValueOrDefault ());
+            var drawRect = new Rectangle (ContentToScreen (Point.Empty), ContentSize);
 
             TextFormatter?.Draw (
                                  drawRect,

+ 1 - 1
Terminal.Gui/View/ViewSubViews.cs

@@ -872,7 +872,7 @@ public partial class View
     /// <returns>Viewport-relative cursor position. Return <see langword="null"/> to ensure the cursor is not visible.</returns>
     public virtual Point? PositionCursor ()
     {
-        if (IsInitialized && CanFocus && HasFocus && ContentSize.HasValue)
+        if (IsInitialized && CanFocus && HasFocus)
         {
             // By default, position the cursor at the hotkey (if any) or 0, 0.
             Move (TextFormatter.HotKeyPos == -1 ? 0 : TextFormatter.CursorPosition, 0);

+ 9 - 14
Terminal.Gui/View/ViewText.cs

@@ -175,8 +175,13 @@ public partial class View
     /// <returns></returns>
     internal void SetTextFormatterSize ()
     {
+        // View subclasses can override UpdateTextFormatterText to modify the Text it holds (e.g. Checkbox and Button).
+        // We need to ensure TextFormatter is accurate by calling it here.
         UpdateTextFormatterText ();
 
+        // Default is to use ContentSize.
+        var size = ContentSize;
+
         // TODO: This is a hack. Figure out how to move this into DimDimAuto
         // Use _width & _height instead of Width & Height to avoid debug spew
         Dim.DimAuto widthAuto = _width as Dim.DimAuto;
@@ -184,30 +189,20 @@ public partial class View
         if ((widthAuto is {} && widthAuto._style.HasFlag (Dim.DimAutoStyle.Text))
             || (heightAuto is {} && heightAuto._style.HasFlag (Dim.DimAutoStyle.Text)))
         {
-            // We always use TF in autosize = false mode
-            TextFormatter.AutoSize = false;
-
-            var size = TextFormatter.GetAutoSize ();
+            size = TextFormatter.GetAutoSize ();
 
             if (widthAuto is null || !widthAuto._style.HasFlag (Dim.DimAutoStyle.Text))
             {
-                size.Width = ContentSize.Value.Width;
+                size.Width = ContentSize.Width;
             }
 
             if (heightAuto is null || !heightAuto._style.HasFlag (Dim.DimAutoStyle.Text))
             {
-                size.Height = ContentSize.Value.Height;
+                size.Height = ContentSize.Height;
             }
-
-            // Whenever DimAutoStyle.Text is set, ContentSize will match TextFormatter.Size.
-            //ContentSize = size;//TextFormatter.Size == Size.Empty ? null : TextFormatter.Size;
-            TextFormatter.Size = size;
-            return;
         }
 
-        // We always use TF in autosize = false mode
-        TextFormatter.AutoSize = false;
-        TextFormatter.Size = new Size (ContentSize.GetValueOrDefault ().Width, ContentSize.GetValueOrDefault ().Height);
+        TextFormatter.Size = size;
     }
 
     private void UpdateTextDirection (TextDirection newDirection)

+ 3 - 2
Terminal.Gui/Views/CheckBox.cs

@@ -180,11 +180,12 @@ public class CheckBox : View
 
     private string GetFormatterText ()
     {
-        if (Width is Dim.DimAuto || string.IsNullOrEmpty (Title) || ContentSize?.Width <= 2)
+        // BUGBUG: Dim.DimAuto is an internal API
+        if (Width is Dim.DimAuto || string.IsNullOrEmpty (Title) || ContentSize.Width <= 2)
         {
             return Text;
         }
 
-        return ContentSize is null ? Text : Text [..Math.Min (ContentSize.Value.Width - 2, Text.GetRuneCount ())];
+        return Text [..Math.Min (ContentSize.Width - 2, Text.GetRuneCount ())];
     }
 }

+ 2 - 2
Terminal.Gui/Views/ComboBox.cs

@@ -618,8 +618,8 @@ public class ComboBox : View
         {
             _search.Width = _listview.Width = _autoHide ? Viewport.Width - 1 : Viewport.Width;
             _listview.Height = CalculatetHeight ();
-            _search.SetRelativeLayout (ContentSize.GetValueOrDefault());
-            _listview.SetRelativeLayout (ContentSize.GetValueOrDefault ());
+            _search.SetRelativeLayout (ContentSize);
+            _listview.SetRelativeLayout (ContentSize);
         }
     }
 

+ 0 - 1
Terminal.Gui/Views/Label.cs

@@ -17,7 +17,6 @@ public class Label : View
     {
         Height = Dim.Auto (Dim.DimAutoStyle.Text);
         Width = Dim.Auto (Dim.DimAutoStyle.Text);
-        TextFormatter.AutoSize = true;
 
         // Things this view knows how to do
         AddCommand (Command.HotKey, FocusNext);

+ 1 - 1
Terminal.Gui/Views/MessageBox.cs

@@ -466,7 +466,7 @@ public static class MessageBox
                                      + adornmentsThickness.Vertical);
             }
 
-            d.SetRelativeLayout (d.SuperView?.ContentSize.GetValueOrDefault () ?? Application.Top.ContentSize.GetValueOrDefault ());
+            d.SetRelativeLayout (d.SuperView?.ContentSize ?? Application.Top.ContentSize);
             d.LayoutSubviews ();
         }
     }

+ 15 - 15
Terminal.Gui/Views/ScrollView.cs

@@ -88,10 +88,10 @@ public class ScrollView : View
         AddCommand (Command.PageDown, () => ScrollDown (Viewport.Height));
         AddCommand (Command.PageLeft, () => ScrollLeft (Viewport.Width));
         AddCommand (Command.PageRight, () => ScrollRight (Viewport.Width));
-        AddCommand (Command.TopHome, () => ScrollUp (ContentSize.Value.Height));
-        AddCommand (Command.BottomEnd, () => ScrollDown (ContentSize.Value.Height));
-        AddCommand (Command.LeftHome, () => ScrollLeft (ContentSize.Value.Width));
-        AddCommand (Command.RightEnd, () => ScrollRight (ContentSize.Value.Width));
+        AddCommand (Command.TopHome, () => ScrollUp (ContentSize.Height));
+        AddCommand (Command.BottomEnd, () => ScrollDown (ContentSize.Height));
+        AddCommand (Command.LeftHome, () => ScrollLeft (ContentSize.Width));
+        AddCommand (Command.RightEnd, () => ScrollRight (ContentSize.Width));
 
         // Default keybindings for this view
         KeyBindings.Add (Key.CursorUp, Command.ScrollUp);
@@ -127,7 +127,7 @@ public class ScrollView : View
                            }
 
                            SetContentOffset (_contentOffset);
-                           _contentView.Frame = new Rectangle (ContentOffset, ContentSize.GetValueOrDefault ());
+                           _contentView.Frame = new Rectangle (ContentOffset, ContentSize);
 
                            // PERF: How about calls to Point.Offset instead?
                            _vertical.ChangedPosition += delegate { ContentOffset = new Point (ContentOffset.X, _vertical.Position); };
@@ -244,26 +244,26 @@ public class ScrollView : View
                 _horizontal.OtherScrollBarView.KeepContentAlwaysInViewport = value;
                 Point p = default;
 
-                if (value && -_contentOffset.X + Viewport.Width > ContentSize.GetValueOrDefault ().Width)
+                if (value && -_contentOffset.X + Viewport.Width > ContentSize.Width)
                 {
                     p = new Point (
-                                   ContentSize.GetValueOrDefault ().Width - Viewport.Width + (_showVerticalScrollIndicator ? 1 : 0),
+                                   ContentSize.Width - Viewport.Width + (_showVerticalScrollIndicator ? 1 : 0),
                                    -_contentOffset.Y
                                   );
                 }
 
-                if (value && -_contentOffset.Y + Viewport.Height > ContentSize.GetValueOrDefault ().Height)
+                if (value && -_contentOffset.Y + Viewport.Height > ContentSize.Height)
                 {
                     if (p == default (Point))
                     {
                         p = new Point (
                                        -_contentOffset.X,
-                                       ContentSize.GetValueOrDefault ().Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0)
+                                       ContentSize.Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0)
                                       );
                     }
                     else
                     {
-                        p.Y = ContentSize.GetValueOrDefault ().Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0);
+                        p.Y = ContentSize.Height - Viewport.Height + (_showHorizontalScrollIndicator ? 1 : 0);
                     }
                 }
 
@@ -607,7 +607,7 @@ public class ScrollView : View
     {
         // INTENT: Unclear intent. How about a call to Offset?
         _contentOffset = new Point (-Math.Abs (offset.X), -Math.Abs (offset.Y));
-        _contentView.Frame = new Rectangle (_contentOffset, ContentSize.GetValueOrDefault ());
+        _contentView.Frame = new Rectangle (_contentOffset, ContentSize);
         int p = Math.Max (0, -_contentOffset.Y);
 
         if (_vertical.Position != p)
@@ -638,7 +638,7 @@ public class ScrollView : View
         bool v = false, h = false;
         var p = false;
 
-        if (ContentSize is { } && (Viewport.Height == 0 || Viewport.Height > ContentSize.Value.Height))
+        if (ContentSize is { } && (Viewport.Height == 0 || Viewport.Height > ContentSize.Height))
         {
             if (ShowVerticalScrollIndicator)
             {
@@ -647,7 +647,7 @@ public class ScrollView : View
 
             v = false;
         }
-        else if (ContentSize is { } && Viewport.Height > 0 && Viewport.Height == ContentSize.Value.Height)
+        else if (ContentSize is { } && Viewport.Height > 0 && Viewport.Height == ContentSize.Height)
         {
             p = true;
         }
@@ -661,7 +661,7 @@ public class ScrollView : View
             v = true;
         }
 
-        if (ContentSize is { } && (Viewport.Width == 0 || Viewport.Width > ContentSize.Value.Width))
+        if (ContentSize is { } && (Viewport.Width == 0 || Viewport.Width > ContentSize.Width))
         {
             if (ShowHorizontalScrollIndicator)
             {
@@ -670,7 +670,7 @@ public class ScrollView : View
 
             h = false;
         }
-        else if (ContentSize is { } && Viewport.Width > 0 && Viewport.Width == ContentSize.Value.Width && p)
+        else if (ContentSize is { } && Viewport.Width > 0 && Viewport.Width == ContentSize.Width && p)
         {
             if (ShowHorizontalScrollIndicator)
             {

+ 3 - 3
Terminal.Gui/Views/Slider.cs

@@ -619,8 +619,8 @@ public class Slider<T> : View
 
         Thickness adornmentsThickness = GetAdornmentsThickness ();
 
-        var svWidth = SuperView?.ContentSize?.Width ?? 0;
-        var svHeight = SuperView?.ContentSize?.Height ?? 0;
+        var svWidth = SuperView?.ContentSize.Width ?? 0;
+        var svHeight = SuperView?.ContentSize.Height ?? 0;
 
         if (_config._sliderOrientation == Orientation.Horizontal)
         {
@@ -642,7 +642,7 @@ public class Slider<T> : View
             int size = 0;
             if (ContentSize is { })
             {
-                size = _config._sliderOrientation == Orientation.Horizontal ? ContentSize.Value.Width : ContentSize.Value.Height;
+                size = _config._sliderOrientation == Orientation.Horizontal ? ContentSize.Width : ContentSize.Height;
             }
 
             int max_legend; // Because the legends are centered, the longest one determines inner spacing

+ 2 - 2
UICatalog/Scenarios/ASCIICustomButton.cs

@@ -269,7 +269,7 @@ public class ASCIICustomButtonTest : Scenario
                 case KeyCode.End:
                     _scrollView.ContentOffset = new Point (
                                                            _scrollView.ContentOffset.X,
-                                                           -(_scrollView.ContentSize.GetValueOrDefault ().Height
+                                                           -(_scrollView.ContentSize.Height
                                                              - _scrollView.Frame.Height
                                                              + (_scrollView.ShowHorizontalScrollIndicator ? 1 : 0))
                                                           );
@@ -287,7 +287,7 @@ public class ASCIICustomButtonTest : Scenario
                                                            Math.Max (
                                                                      _scrollView.ContentOffset.Y
                                                                      - _scrollView.Frame.Height,
-                                                                     -(_scrollView.ContentSize.GetValueOrDefault ().Height
+                                                                     -(_scrollView.ContentSize.Height
                                                                        - _scrollView.Frame.Height
                                                                        + (_scrollView.ShowHorizontalScrollIndicator
                                                                               ? 1

+ 4 - 4
UICatalog/Scenarios/ContentScrolling.cs

@@ -227,7 +227,7 @@ public class ContentScrolling : Scenario
 
         var contentSizeWidth = new Buttons.NumericUpDown<int>
         {
-            Value = view.ContentSize.GetValueOrDefault ().Width,
+            Value = view.ContentSize.Width,
             X = Pos.Right (labelContentSize) + 1,
             Y = Pos.Top (labelContentSize)
         };
@@ -242,7 +242,7 @@ public class ContentScrolling : Scenario
                 return;
             }
 
-            view.SetContentSize (view.ContentSize.GetValueOrDefault () with { Width = e.NewValue });
+            view.SetContentSize (view.ContentSize with { Width = e.NewValue });
         }
 
         var labelComma = new Label
@@ -254,7 +254,7 @@ public class ContentScrolling : Scenario
 
         var contentSizeHeight = new Buttons.NumericUpDown<int>
         {
-            Value = view.ContentSize.GetValueOrDefault ().Height,
+            Value = view.ContentSize.Height,
             X = Pos.Right (labelComma) + 1,
             Y = Pos.Top (labelContentSize),
             CanFocus = false
@@ -270,7 +270,7 @@ public class ContentScrolling : Scenario
                 return;
             }
 
-            view.SetContentSize (view.ContentSize.GetValueOrDefault () with { Height = e.NewValue });
+            view.SetContentSize (view.ContentSize with { Height = e.NewValue });
         }
 
         var cbClearOnlyVisible = new CheckBox

+ 1 - 1
UnitTests/View/Layout/Dim.AutoTests.cs

@@ -607,7 +607,7 @@ public class DimAutoTests (ITestOutputHelper output)
 
         superView.BeginInit ();
         superView.EndInit ();
-        superView.SetRelativeLayout (superView.ContentSize.GetValueOrDefault ());
+        superView.SetRelativeLayout (superView.ContentSize);
 
         superView.LayoutSubviews ();
         Assert.Equal (expectedSubWidth, subView.Frame.Width);

+ 2 - 2
UnitTests/Views/ScrollViewTests.cs

@@ -488,8 +488,8 @@ public class ScrollViewTests
         top.Add (sv);
         Application.Begin (top);
 
-        Assert.Equal (50, sv.ContentSize.GetValueOrDefault ().Width);
-        Assert.Equal (50, sv.ContentSize.GetValueOrDefault ().Height);
+        Assert.Equal (50, sv.ContentSize.Width);
+        Assert.Equal (50, sv.ContentSize.Height);
         Assert.True (sv.AutoHideScrollBars);
         Assert.True (sv.ShowHorizontalScrollIndicator);
         Assert.True (sv.ShowVerticalScrollIndicator);