Browse Source

Updated almosta all tests to not use AutoSize

Tig 1 year ago
parent
commit
65b36a9268

+ 0 - 17
Terminal.Gui/View/ViewText.cs

@@ -213,23 +213,6 @@ public partial class View
 
     #region AutoSize
 
-    /// <summary>
-    ///     Gets or sets a flag that determines whether the View will be automatically resized to fit the <see cref="Text"/>
-    ///     within <see cref="Viewport"/>.
-    ///     <para>
-    ///         The default is <see langword="false"/>. Set to <see langword="true"/> to turn on AutoSize. If
-    ///         <see langword="true"/> then <see cref="Width"/> and <see cref="Height"/> will be used if <see cref="Text"/> can
-    ///         fit; if <see cref="Text"/> won't fit the view will be resized as needed.
-    ///     </para>
-    ///     <para>
-    ///         If <see cref="AutoSize"/> is set to <see langword="true"/> then <see cref="Width"/> and <see cref="Height"/>
-    ///         will be changed to <see cref="Dim.DimAbsolute"/> if they are not already.
-    ///     </para>
-    ///     <para>
-    ///         If <see cref="AutoSize"/> is set to <see langword="false"/> then <see cref="Width"/> and <see cref="Height"/>
-    ///         will left unchanged.
-    ///     </para>
-    /// </summary>
     [ObsoleteAttribute ("Use Dim.Auto instead.", false)]
     public virtual bool AutoSize
     {

+ 1 - 1
UICatalog/Scenarios/ProgressBarStyles.cs

@@ -65,7 +65,7 @@ public class ProgressBarStyles : Scenario
         {
             var colorPicker = new ColorPicker { Title = text, SelectedColor = colorName };
 
-            var dialog = new Dialog { AutoSize = false, Title = text };
+            var dialog = new Dialog { Title = text };
 
             dialog.Initialized += (sender, args) =>
                                      {

+ 1 - 1
UnitTests/View/Text/AutoSizeFalseTests.cs

@@ -2,7 +2,7 @@
 
 namespace Terminal.Gui.ViewTests;
 
-/// <summary>Tests of the  <see cref="View.Text"/> property with <see cref="View.AutoSize"/> set to false.</summary>
+/// <summary>Tests of the  <see cref="View.Text"/> property with AutoSize set to false.</summary>
 public class AutoSizeFalseTests (ITestOutputHelper output)
 {
     [Fact]

+ 34 - 39
UnitTests/View/Text/AutoSizeTrueTests.cs

@@ -4,7 +4,7 @@ using Xunit.Abstractions;
 
 namespace Terminal.Gui.ViewTests;
 
-/// <summary>Tests of the  <see cref="View.AutoSize"/> property which auto sizes Views based on <see cref="Text"/>.</summary>
+/// <summary>Tests of the View.AutoSize property which auto sizes Views based on <see cref="Text"/>.</summary>
 public class AutoSizeTrueTests (ITestOutputHelper output)
 {
     private readonly string [] expecteds = new string [21]
@@ -746,10 +746,11 @@ public class AutoSizeTrueTests (ITestOutputHelper output)
     public void AutoSize_False_Label_Height_Zero_Stays_Zero ()
     {
         var text = "Label";
-        var label = new Label { 
-            Text = text, 
-            Width = Dim.Auto(Dim.DimAutoStyle.Text), 
-            Height = Dim.Auto(Dim.DimAutoStyle.Text)
+        var label = new Label
+        {
+            Text = text,
+            Width = Dim.Auto (Dim.DimAutoStyle.Text),
+            Height = Dim.Auto (Dim.DimAutoStyle.Text)
         };
         label.Width = Dim.Fill () - text.Length;
         label.Height = 0;
@@ -786,7 +787,7 @@ public class AutoSizeTrueTests (ITestOutputHelper output)
         win.Draw ();
 
         Assert.Equal (Rectangle.Empty, label.Frame);
-//        Assert.Equal (new (5, 1), label.TextFormatter.Size);
+        //        Assert.Equal (new (5, 1), label.TextFormatter.Size);
 
         //Exception exception = Record.Exception (
         //                                        () => Assert.Equal (
@@ -946,7 +947,7 @@ public class AutoSizeTrueTests (ITestOutputHelper output)
         //label.Width = Dim.Fill () - text.Length;
         Application.Refresh ();
 
-        Assert.True (label.AutoSize);
+
         Assert.Equal (new (0, 0, 5, 1), label.Frame);
         Assert.Equal (new (5, 1), label.TextFormatter.Size);
         Assert.Single (label.TextFormatter.GetLines ());
@@ -1007,10 +1008,9 @@ Y
 
         Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
 
-        label.AutoSize = false;
         label.Width = 10;
         label.Height = 2;
-        Assert.False (label.AutoSize);
+
         Assert.Equal (new (0, 0, 10, 2), label.Frame);
 
         top.LayoutSubviews ();
@@ -1041,7 +1041,7 @@ Y
         top.Add (label, viewX, viewY);
         RunState rs = Application.Begin (top);
 
-        Assert.True (label.AutoSize);
+
         label.Text = "Hello";
         Application.Refresh ();
 
@@ -1058,12 +1058,11 @@ Y
 
         Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
 
-        label.AutoSize = false;
         label.Width = 2;
         label.Height = 10;
         Application.Refresh ();
 
-        Assert.False (label.AutoSize);
+
         Assert.Equal (new (0, 0, 2, 10), label.Frame);
 
         expected = @"
@@ -1103,7 +1102,7 @@ Y
         Assert.Equal (new Rectangle (0, 0, 15, 15), win.Margin.Frame);
         Assert.Equal (new Rectangle (0, 0, 15, 15), win.Border.Frame);
         Assert.Equal (new Rectangle (1, 1, 13, 13), win.Padding.Frame);
-        Assert.False (view.AutoSize);
+
         Assert.Equal (TextDirection.LeftRight_TopBottom, view.TextDirection);
         Assert.Equal (Rectangle.Empty, view.Frame);
         Assert.Equal ("Absolute(0)", view.X.ToString ());
@@ -1163,7 +1162,9 @@ Y
 
         pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
 
-        view.AutoSize = true;
+        view.Width = Dim.Auto ();
+        view.Height = Dim.Auto ();
+
         view.Text = "Hello Worlds";
         Application.Refresh ();
         int len = "Hello Worlds".Length;
@@ -1217,7 +1218,8 @@ Y
         pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
 
         // Setting to false causes Width and Height to be set to the current ContentSize
-        view.AutoSize = false;
+        view.Width = 1;
+        view.Height = 12;
 
         Assert.Equal (new Rectangle (0, 0, 1, 12), view.Frame);
 
@@ -1312,7 +1314,9 @@ Y
 
         pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
 
-        view.AutoSize = true;
+        view.Width = Dim.Auto ();
+        view.Height = Dim.Auto ();
+
         Application.Refresh ();
 
         Assert.Equal (new Rectangle (0, 0, 1, 12), view.Frame);
@@ -1350,8 +1354,10 @@ Y
             TextDirection = TextDirection.TopBottom_LeftRight,
             Height = Dim.Fill () - text.Length,
             Text = text,
-            AutoSize = true
         };
+        view.Width = Dim.Auto ();
+        view.Height = Dim.Auto ();
+
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill () };
         win.Add (view);
         var top = new Toplevel ();
@@ -1360,7 +1366,7 @@ Y
         ((FakeDriver)Application.Driver).SetBufferSize (4, 10);
 
         Assert.Equal (5, text.Length);
-        Assert.True (view.AutoSize);
+
         Assert.Equal (new (0, 0, 1, 5), view.Frame);
         Assert.Equal (new (1, 5), view.TextFormatter.Size);
         Assert.Equal (new List<string> { "Views" }, view.TextFormatter.GetLines ());
@@ -1420,9 +1426,9 @@ Y
         var view = new View
         {
             TextDirection = TextDirection.TopBottom_LeftRight,
-            Height = Dim.Fill () - text.Length,
             Text = text,
-            AutoSize = true
+            Width = Dim.Auto (),
+            Height = Dim.Auto ()
         };
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill () };
         win.Add (view);
@@ -1432,7 +1438,6 @@ Y
         ((FakeDriver)Application.Driver).SetBufferSize (4, 10);
 
         Assert.Equal (5, text.Length);
-        Assert.True (view.AutoSize);
         Assert.Equal (new (0, 0, 2, 5), view.Frame);
         Assert.Equal (new (2, 5), view.TextFormatter.Size);
         Assert.Equal (new List<string> { "界View" }, view.TextFormatter.GetLines ());
@@ -1497,16 +1502,15 @@ Y
 
         var horizontalView = new View
         {
-            AutoSize = true,
-
-            //Width = 11,  
-            //Height = 2, 
+            Width = Dim.Auto (),
+            Height = Dim.Auto (),
             Text = text
         };
 
         var verticalView = new View
         {
-            AutoSize = true,
+            Width = Dim.Auto (),
+            Height = Dim.Auto (),
             Y = 3,
 
             //Height = 11,
@@ -1517,8 +1521,6 @@ Y
 
         var win = new Window
         {
-            AutoSize = true,
-
             Width = Dim.Fill (),
             Height = Dim.Fill (),
             Text = "Window"
@@ -1529,8 +1531,6 @@ Y
         RunState rs = Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (20, 20);
 
-        Assert.True (horizontalView.AutoSize);
-        Assert.True (verticalView.AutoSize);
         Assert.Equal (new Rectangle (0, 0, 11, 2), horizontalView.Frame);
         Assert.Equal (new Rectangle (0, 3, 2, 11), verticalView.Frame);
 
@@ -1605,7 +1605,8 @@ Y
         {
             Id = "verticalView",
             Y = 3,
-            AutoSize = true,
+            Width = Dim.Auto (),
+            Height = Dim.Auto (),
             Text = text,
             TextDirection = TextDirection.TopBottom_LeftRight
         };
@@ -1616,8 +1617,6 @@ Y
         RunState rs = Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (22, 22);
 
-        Assert.True (horizontalView.AutoSize);
-        Assert.True (verticalView.AutoSize);
         Assert.Equal (new (text.GetColumns (), 1), horizontalView.TextFormatter.Size);
         Assert.Equal (new (2, 8), verticalView.TextFormatter.Size);
         //Assert.Equal (new (0, 0, 10, 1), horizontalView.Frame);
@@ -1722,7 +1721,7 @@ Y
 
         Application.End (rs);
     }
-    
+
     [Fact]
     [AutoInitShutdown]
     public void GetTextFormatterBoundsSize_GetSizeNeededForText_HotKeySpecifier ()
@@ -1786,7 +1785,7 @@ Y
         Assert.Equal (new (0, 0, 20, 1), view.Frame);
     }
 
-    
+
     [Theory]
     [AutoInitShutdown]
     [InlineData (true)]
@@ -1948,10 +1947,6 @@ Y
         Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (9, height + 2);
 
-        Assert.True (lblLeft.AutoSize == autoSize);
-        Assert.True (lblCenter.AutoSize == autoSize);
-        Assert.True (lblRight.AutoSize == autoSize);
-        Assert.True (lblJust.AutoSize == autoSize);
         Assert.True (lblLeft.TextFormatter.AutoSize == autoSize);
         Assert.True (lblCenter.TextFormatter.AutoSize == autoSize);
         Assert.True (lblRight.TextFormatter.AutoSize == autoSize);

+ 2 - 4
UnitTests/View/ViewTests.cs

@@ -158,13 +158,11 @@ public class ViewTests
 
         if (label)
         {
-            Assert.True (v.AutoSize);
             Assert.False (v.CanFocus);
             Assert.Equal (new Rectangle (0, 0, 20, 1), v.Frame);
         }
         else
         {
-            Assert.False (v.AutoSize);
             Assert.True (v.CanFocus);
             Assert.Equal (new Rectangle (0, 0, 20, 1), v.Frame);
         }
@@ -488,7 +486,6 @@ At 0,0
 
         button.LayoutComplete += (s, e) => { Assert.Equal (new Rectangle (0, 0, 13, 1), button._needsDisplayRect); };
 
-        Assert.True (label.AutoSize);
         Assert.Equal (new Rectangle (0, 0, 80, 25), top.Frame);
         Assert.Equal (new Rectangle (20, 8, 40, 8), frame.Frame);
 
@@ -1013,7 +1010,8 @@ At 0,0
         top.Add (win);
         RunState rs = Application.Begin (top);
 
-        view.AutoSize = true;
+        view.Width = Dim.Auto ();
+        view.Height = Dim.Auto ();
         Assert.Equal ("Testing visibility.".Length, view.Frame.Width);
         Assert.True (view.Visible);
         ((FakeDriver)Application.Driver).SetBufferSize (30, 5);

+ 0 - 4
UnitTests/Views/AllViewsTests.cs

@@ -27,9 +27,6 @@ public class AllViewsTests (ITestOutputHelper output) : TestsAllViews
         view.X = Pos.Center ();
         view.Y = Pos.Center ();
 
-        // Turn off AutoSize
-        view.AutoSize = false;
-
         // Ensure the view has positive dimensions
         view.Width = 10;
         view.Height = 10;
@@ -75,7 +72,6 @@ public class AllViewsTests (ITestOutputHelper output) : TestsAllViews
 
         Toplevel top = new ();
 
-        vType.AutoSize = false;
         vType.X = 0;
         vType.Y = 0;
         vType.Width = 10;

+ 0 - 2
UnitTests/Views/ButtonTests.cs

@@ -761,7 +761,6 @@ public class ButtonTests (ITestOutputHelper output)
 
         var button = new Button ()
         {
-            AutoSize = false,
             Width = 1,
             Height = 1,
             WantContinuousButtonPressed = true
@@ -797,7 +796,6 @@ public class ButtonTests (ITestOutputHelper output)
 
         var button = new Button ()
         {
-            AutoSize = false,
             Width = 1,
             Height = 1,
             WantContinuousButtonPressed = true

+ 0 - 5
UnitTests/Views/CheckBoxTests.cs

@@ -418,7 +418,6 @@ public class CheckBoxTests
             Y = Pos.Center (),
             Text = "Check this out 你",
             TextAlignment = TextAlignment.Centered,
-            AutoSize = false,
             Width = 25
         };
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill (), Title = "Test Demo 你" };
@@ -432,7 +431,6 @@ public class CheckBoxTests
         Assert.Equal (TextAlignment.Centered, checkBox.TextAlignment);
         Assert.Equal (new (1, 1, 25, 1), checkBox.Frame);
         Assert.Equal (_size25x1, checkBox.TextFormatter.Size);
-        Assert.False (checkBox.AutoSize);
 
         var expected = @$"
 ┌┤Test Demo 你├──────────────┐
@@ -536,7 +534,6 @@ public class CheckBoxTests
             X = 1,
             Y = Pos.Center (),
             Text = "Check this out 你",
-            AutoSize = false,
             Width = 25
         };
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill (), Title = "Test Demo 你" };
@@ -587,7 +584,6 @@ public class CheckBoxTests
             Y = Pos.Center (),
             Text = "Check this out 你",
             TextAlignment = TextAlignment.Right,
-            AutoSize = false,
             Width = 25
         };
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill (), Title = "Test Demo 你" };
@@ -601,7 +597,6 @@ public class CheckBoxTests
         Assert.Equal (TextAlignment.Right, checkBox.TextAlignment);
         Assert.Equal (new (1, 1, 25, 1), checkBox.Frame);
         Assert.Equal (_size25x1, checkBox.TextFormatter.Size);
-        Assert.False (checkBox.AutoSize);
 
         var expected = @$"
 ┌┤Test Demo 你├──────────────┐

+ 0 - 5
UnitTests/Views/ComboBoxTests.cs

@@ -20,7 +20,6 @@ public class ComboBoxTests
         cb.LayoutSubviews ();
         Assert.Equal ("Two", cb.Text);
         Assert.NotNull (cb.Source);
-        Assert.False (cb.AutoSize);
         Assert.Equal (new Rectangle (0, 0, 0, 2), cb.Frame);
         Assert.Equal (1, cb.SelectedItem);
     }
@@ -35,7 +34,6 @@ public class ComboBoxTests
         cb.LayoutSubviews ();
         Assert.Equal (string.Empty, cb.Text);
         Assert.Null (cb.Source);
-        Assert.False (cb.AutoSize);
         Assert.Equal (new Rectangle (0, 0, 0, 2), cb.Frame);
         Assert.Equal (-1, cb.SelectedItem);
 
@@ -45,7 +43,6 @@ public class ComboBoxTests
         cb.LayoutSubviews ();
         Assert.Equal ("Test", cb.Text);
         Assert.Null (cb.Source);
-        Assert.False (cb.AutoSize);
         Assert.Equal (new Rectangle (0, 0, 0, 2), cb.Frame);
         Assert.Equal (-1, cb.SelectedItem);
 
@@ -62,7 +59,6 @@ public class ComboBoxTests
         cb.LayoutSubviews ();
         Assert.Equal (string.Empty, cb.Text);
         Assert.NotNull (cb.Source);
-        Assert.False (cb.AutoSize);
         Assert.Equal (new Rectangle (1, 2, 10, 20), cb.Frame);
         Assert.Equal (-1, cb.SelectedItem);
 
@@ -72,7 +68,6 @@ public class ComboBoxTests
         cb.LayoutSubviews ();
         Assert.Equal (string.Empty, cb.Text);
         Assert.NotNull (cb.Source);
-        Assert.False (cb.AutoSize);
         Assert.Equal (new Rectangle (0, 0, 0, 2), cb.Frame);
         Assert.Equal (-1, cb.SelectedItem);
     }

+ 11 - 11
UnitTests/Views/LabelTests.cs

@@ -91,7 +91,7 @@ public class LabelTests
     [AutoInitShutdown]
     public void AutoSize_Stays_True_AnchorEnd ()
     {
-        var label = new Label { Y = Pos.Center (), Text = "Say Hello 你", AutoSize = true };
+        var label = new Label { Y = Pos.Center (), Text = "Say Hello 你" };
         label.X = Pos.AnchorEnd (0) - Pos.Function (() => label.TextFormatter.Text.GetColumns ());
 
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill () };
@@ -99,7 +99,7 @@ public class LabelTests
         var top = new Toplevel ();
         top.Add (win);
 
-        Assert.True (label.AutoSize);
+       
 
         Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (30, 5);
@@ -114,9 +114,9 @@ public class LabelTests
 
         TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 
-        Assert.True (label.AutoSize);
+       
         label.Text = "Say Hello 你 changed";
-        Assert.True (label.AutoSize);
+       
         Application.Refresh ();
 
         expected = @"
@@ -156,9 +156,9 @@ public class LabelTests
 
         TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 
-        Assert.True (label.AutoSize);
+       
         label.Text = "Say Hello 你 changed";
-        Assert.True (label.AutoSize);
+       
         Application.Refresh ();
 
         expected = @"
@@ -176,18 +176,18 @@ public class LabelTests
     [AutoInitShutdown]
     public void AutoSize_Stays_True_With_EmptyText ()
     {
-        var label = new Label { X = Pos.Center (), Y = Pos.Center (), AutoSize = true };
+        var label = new Label { X = Pos.Center (), Y = Pos.Center () };
 
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill () };
         win.Add (label);
         var top = new Toplevel ();
         top.Add (win);
 
-        Assert.True (label.AutoSize);
+       
 
         label.Text = "Say Hello 你";
 
-        Assert.True (label.AutoSize);
+       
 
         Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (30, 5);
@@ -285,7 +285,7 @@ This TextFormatter (tf2) is rewritten.                                 ",
         top.Add (label);
         Application.Begin (top);
 
-        Assert.True (label.AutoSize);
+       
         Assert.Equal (new Rectangle (0, 0, 16, 1), label.Frame);
 
         var expected = @"
@@ -446,7 +446,7 @@ e
     [AutoInitShutdown]
     public void Update_Parameterless_Only_On_Or_After_Initialize ()
     {
-        var label = new Label { X = Pos.Center (), Y = Pos.Center (), Text = "Say Hello 你", AutoSize = true };
+        var label = new Label { X = Pos.Center (), Y = Pos.Center (), Text = "Say Hello 你" };
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill () };
         win.Add (label);
         var top = new Toplevel ();

+ 1 - 1
UnitTests/Views/ScrollBarViewTests.cs

@@ -1126,7 +1126,7 @@ This is a test
     {
         var clicked = false;
         var text = "This is a test\nThis is a test\nThis is a test\nThis is a test\nThis is a test";
-        var label = new Label { AutoSize = false, Width = 14, Height = 5, Text = text };
+        var label = new Label { Width = 14, Height = 5, Text = text };
         var btn = new Button { X = 14, Text = "Click Me!" };
         btn.Accept += (s, e) => clicked = true;
         var top = new Toplevel ();

+ 4 - 6
UnitTests/Views/ScrollViewTests.cs

@@ -392,10 +392,9 @@ public class ScrollViewTests
 
         var view = new View
         {
-            Width = size.Width,
-            Height = size.Height,
             ColorScheme = new ColorScheme { Normal = new Attribute (Color.Blue, Color.Yellow) },
-            AutoSize = true,
+            Width = Dim.Auto (Dim.DimAutoStyle.Text),
+            Height = Dim.Auto (Dim.DimAutoStyle.Text),
             Text = text
         };
         sv.Add (view);
@@ -519,14 +518,13 @@ public class ScrollViewTests
         view.Add (
                   new Label
                   {
-                      AutoSize = false, Width = Dim.Fill (), Height = 1, Text = rule.Repeat (size.Width / rule.Length)
+                      Width = Dim.Fill (), Height = 1, Text = rule.Repeat (size.Width / rule.Length)
                   }
                  );
 
         view.Add (
                   new Label
                   {
-                      AutoSize = false,
                       Height = Dim.Fill (),
                       Width = 1,
                       Text = rule.Repeat (size.Height / rule.Length),
@@ -1083,7 +1081,7 @@ public class ScrollViewTests
             Height = height;
 
             //labelFill = new Label { AutoSize = false, X = Pos.Center (), Y = Pos.Center (), Width = Dim.Fill (), Height = Dim.Fill (), Visible = false };
-            labelFill = new Label { AutoSize = false, Width = Dim.Fill (), Height = Dim.Fill (), Visible = false };
+            labelFill = new Label { Width = Dim.Fill (), Height = Dim.Fill (), Visible = false };
 
             labelFill.LayoutComplete += (s, e) =>
                                         {

+ 22 - 21
UnitTests/Views/SliderTests.cs

@@ -180,8 +180,7 @@ public class SliderTests
     public void MovePlus_Should_MoveFocusRight_When_OptionIsAvailable ()
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3, 4 });
-        slider.AutoSize = true;
+        Slider<int> slider = new (new () { 1, 2, 3, 4 });
 
         // Act
         bool result = slider.MovePlus ();
@@ -195,8 +194,8 @@ public class SliderTests
     public void MovePlus_Should_NotMoveFocusRight_When_AtEnd ()
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3, 4 });
-        slider.AutoSize = true;
+        Slider<int> slider = new (new () { 1, 2, 3, 4 });
+
         slider.FocusedOption = 3;
 
         // Act
@@ -211,7 +210,7 @@ public class SliderTests
     public void OnOptionFocused_Event_Cancelled ()
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3 });
+        Slider<int> slider = new (new () { 1, 2, 3 });
         var eventRaised = false;
         var cancel = false;
         slider.OptionFocused += (sender, args) => eventRaised = true;
@@ -251,7 +250,7 @@ public class SliderTests
     public void OnOptionFocused_Event_Raised ()
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3 });
+        Slider<int> slider = new (new () { 1, 2, 3 });
         var eventRaised = false;
         slider.OptionFocused += (sender, args) => eventRaised = true;
         var newFocusedOption = 1;
@@ -283,8 +282,7 @@ public class SliderTests
     public void Set_Should_Not_UnSetFocusedOption_When_EmptyNotAllowed ()
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3, 4 }) { AllowEmpty = false };
-        slider.AutoSize = true;
+        Slider<int> slider = new (new () { 1, 2, 3, 4 }) { AllowEmpty = false };
 
         Assert.NotEmpty (slider.GetSetOptions ());
 
@@ -302,8 +300,7 @@ public class SliderTests
     public void Set_Should_SetFocusedOption ()
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3, 4 });
-        slider.AutoSize = true;
+        Slider<int> slider = new (new () { 1, 2, 3, 4 });
 
         // Act
         slider.FocusedOption = 2;
@@ -319,7 +316,7 @@ public class SliderTests
     public void TryGetOptionByPosition_InvalidPosition_Failure ()
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3 });
+        Slider<int> slider = new (new () { 1, 2, 3 });
         var x = 10;
         var y = 10;
         var threshold = 2;
@@ -343,8 +340,9 @@ public class SliderTests
     public void TryGetOptionByPosition_ValidPositionHorizontal_Success (int x, int y, int threshold, int expectedData)
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3, 4 });
-        slider.AutoSize = true; // Set auto size to true to enable testing
+        Slider<int> slider = new (new () { 1, 2, 3, 4 });
+
+        // Set auto size to true to enable testing
         slider.InnerSpacing = 2;
 
         // 0123456789
@@ -370,9 +368,10 @@ public class SliderTests
     public void TryGetOptionByPosition_ValidPositionVertical_Success (int x, int y, int threshold, int expectedData)
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3, 4 });
+        Slider<int> slider = new (new () { 1, 2, 3, 4 });
         slider.Orientation = Orientation.Vertical;
-        slider.AutoSize = true; // Set auto size to true to enable testing
+
+        // Set auto size to true to enable testing
         slider.InnerSpacing = 2;
 
         // 0 1
@@ -398,7 +397,7 @@ public class SliderTests
     public void TryGetPositionByOption_InvalidOption_Failure ()
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3 });
+        Slider<int> slider = new (new () { 1, 2, 3 });
         int option = -1;
         (int, int) expectedPosition = (-1, -1);
 
@@ -417,8 +416,9 @@ public class SliderTests
     public void TryGetPositionByOption_ValidOptionHorizontal_Success (int option, int expectedX, int expectedY)
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3, 4 });
-        slider.AutoSize = true; // Set auto size to true to enable testing
+        Slider<int> slider = new (new () { 1, 2, 3, 4 });
+
+        // Set auto size to true to enable testing
         slider.InnerSpacing = 2;
 
         // 0123456789
@@ -440,9 +440,10 @@ public class SliderTests
     public void TryGetPositionByOption_ValidOptionVertical_Success (int option, int expectedX, int expectedY)
     {
         // Arrange
-        Slider<int> slider = new (new() { 1, 2, 3, 4 });
+        Slider<int> slider = new (new () { 1, 2, 3, 4 });
         slider.Orientation = Orientation.Vertical;
-        slider.AutoSize = true; // Set auto size to true to enable testing
+
+        // Set auto size to true to enable testing
         slider.InnerSpacing = 2;
 
         // Act
@@ -464,7 +465,7 @@ public class SliderTests
         slider.EndInit ();
 
         // Act/Assert
-        slider.Options = new() { new () };
+        slider.Options = new () { new () };
     }
 
     [Fact]

+ 0 - 1
UnitTests/Views/TabViewTests.cs

@@ -381,7 +381,6 @@ public class TabViewTests
         var btn = new Button
         {
             Y = Pos.Bottom (tv) + 1,
-            AutoSize = false,
             Height = 1,
             Width = 7,
             Text = "Ok"

+ 7 - 9
UnitTests/Views/TileViewTests.cs

@@ -2282,27 +2282,27 @@ public class TileViewTests
 
         tv.Tiles.ElementAt (0)
           .ContentView.Add (
-                            new Label { AutoSize = false, Width = Dim.Fill (), Height = 1, Text = new string ('1', 100) }
+                            new Label { Width = Dim.Fill (), Height = 1, Text = new string ('1', 100) }
                            );
 
         tv.Tiles.ElementAt (1)
           .ContentView.Add (
-                            new Label { AutoSize = false, Width = Dim.Fill (), Height = 1, Text = new string ('2', 100) }
+                            new Label { Width = Dim.Fill (), Height = 1, Text = new string ('2', 100) }
                            );
 
         tv.Tiles.ElementAt (2)
           .ContentView.Add (
-                            new Label { AutoSize = false, Width = Dim.Fill (), Height = 1, Text = new string ('3', 100) }
+                            new Label { Width = Dim.Fill (), Height = 1, Text = new string ('3', 100) }
                            );
 
         tv.Tiles.ElementAt (3)
           .ContentView.Add (
-                            new Label { AutoSize = false, Width = Dim.Fill (), Height = 1, Text = new string ('4', 100) }
+                            new Label { Width = Dim.Fill (), Height = 1, Text = new string ('4', 100) }
                            );
 
         tv.Tiles.ElementAt (4)
           .ContentView.Add (
-                            new Label { AutoSize = false, Width = Dim.Fill (), Height = 1, Text = new string ('5', 100) }
+                            new Label { Width = Dim.Fill (), Height = 1, Text = new string ('5', 100) }
                            );
 
         var top = new Toplevel ();
@@ -2397,14 +2397,13 @@ public class TileViewTests
 
         container.Tiles.ElementAt (0)
                  .ContentView.Add (
-                                   new Label { AutoSize = false, Width = Dim.Fill (), Height = 1, Text = new string ('1', 100) }
+                                   new Label { Width = Dim.Fill (), Height = 1, Text = new string ('1', 100) }
                                   );
 
         container.Tiles.ElementAt (0)
                  .ContentView.Add (
                                    new Label
                                    {
-                                       AutoSize = false,
                                        Width = Dim.Fill (),
                                        Height = 1,
                                        Y = 1,
@@ -2414,14 +2413,13 @@ public class TileViewTests
 
         container.Tiles.ElementAt (1)
                  .ContentView.Add (
-                                   new Label { AutoSize = false, Width = Dim.Fill (), Height = 1, Text = new string ('2', 100) }
+                                   new Label { Width = Dim.Fill (), Height = 1, Text = new string ('2', 100) }
                                   );
 
         container.Tiles.ElementAt (1)
                  .ContentView.Add (
                                    new Label
                                    {
-                                       AutoSize = false,
                                        Width = Dim.Fill (),
                                        Height = 1,
                                        Y = 1,

+ 0 - 1
UnitTests/Views/ToplevelTests.cs

@@ -1480,7 +1480,6 @@ public class ToplevelTests
                     {
                         X = Pos.Center (),
                         Y = Pos.Center (),
-                        AutoSize = false,
                         Width = Dim.Fill (),
                         Height = Dim.Fill (),
                         TextAlignment = TextAlignment.Centered,