Ver código fonte

Removed un-needed AutoSize tests

Tig 1 ano atrás
pai
commit
bd57b1df11

+ 14 - 8
UnitTests/View/Layout/SetRelativeLayoutTests.cs

@@ -1,4 +1,5 @@
 using Xunit.Abstractions;
+using static Terminal.Gui.Dim;
 
 namespace Terminal.Gui.LayoutTests;
 
@@ -249,7 +250,7 @@ public class SetRelativeLayoutTests
         Assert.Equal (4, testView.Frame.X);
         Assert.Equal (4, testView.Frame.Y);
 
-        testView = new()
+        testView = new ()
         {
             X = Pos.Center () + 1, // ((10 / 2) - (1 / 2)) + 1 = 5 - 1 + 1 = 5
             Y = Pos.Center () + 1,
@@ -261,7 +262,7 @@ public class SetRelativeLayoutTests
         Assert.Equal (5, testView.Frame.X);
         Assert.Equal (5, testView.Frame.Y);
 
-        testView = new()
+        testView = new ()
         {
             X = 1 + Pos.Center (),
             Y = 1 + Pos.Center (),
@@ -273,7 +274,7 @@ public class SetRelativeLayoutTests
         Assert.Equal (5, testView.Frame.X);
         Assert.Equal (5, testView.Frame.Y);
 
-        testView = new()
+        testView = new ()
         {
             X = 1 + Pos.Percent (50),
             Y = Pos.Percent (50) + 1,
@@ -285,7 +286,7 @@ public class SetRelativeLayoutTests
         Assert.Equal (6, testView.Frame.X);
         Assert.Equal (6, testView.Frame.Y);
 
-        testView = new()
+        testView = new ()
         {
             X = Pos.Percent (10) + Pos.Percent (40),
             Y = Pos.Percent (10) + Pos.Percent (40),
@@ -297,7 +298,7 @@ public class SetRelativeLayoutTests
         Assert.Equal (5, testView.Frame.X);
         Assert.Equal (5, testView.Frame.Y);
 
-        testView = new()
+        testView = new ()
         {
             X = 1 + Pos.Percent (10) + Pos.Percent (40) - 1,
             Y = 5 + Pos.Percent (10) + Pos.Percent (40) - 5,
@@ -309,7 +310,7 @@ public class SetRelativeLayoutTests
         Assert.Equal (5, testView.Frame.X);
         Assert.Equal (5, testView.Frame.Y);
 
-        testView = new()
+        testView = new ()
         {
             X = Pos.Left (testView),
             Y = Pos.Left (testView),
@@ -321,7 +322,7 @@ public class SetRelativeLayoutTests
         Assert.Equal (5, testView.Frame.X);
         Assert.Equal (5, testView.Frame.Y);
 
-        testView = new()
+        testView = new ()
         {
             X = 1 + Pos.Left (testView),
             Y = Pos.Top (testView) + 1,
@@ -396,7 +397,12 @@ public class SetRelativeLayoutTests
     public void PosDimFunction ()
     {
         var screen = new Size (30, 1);
-        var view = new View { Text = "abc", AutoSize = true }; // BUGBUG: AutoSize or Width must be set
+        var view = new View
+        {
+            Text = "abc",
+            Width = Auto (DimAutoStyle.Text),
+            Height = Auto (DimAutoStyle.Text)
+        };
         view.X = Pos.AnchorEnd (0) - Pos.Function (GetViewWidth);
 
         int GetViewWidth () { return view.Frame.Width; }

+ 0 - 6
UnitTests/View/Text/AutoSizeFalseTests.cs

@@ -11,13 +11,11 @@ public class AutoSizeFalseTests (ITestOutputHelper output)
         var super = new View { Frame = new (0, 0, 30, 80) };
         var view = new View { Width = Dim.Fill (), Height = Dim.Fill () };
         super.Add (view);
-        Assert.False (view.AutoSize);
 
         view.Text = "New text\nNew line";
         super.LayoutSubviews ();
         Rectangle expectedViewBounds = new (0, 0, 30, 80);
 
-        Assert.False (view.AutoSize);
         Assert.Equal (expectedViewBounds, view.Viewport);
         Assert.False (view.IsInitialized);
 
@@ -25,7 +23,6 @@ public class AutoSizeFalseTests (ITestOutputHelper output)
         super.EndInit ();
 
         Assert.True (view.IsInitialized);
-        Assert.False (view.AutoSize);
         Assert.Equal (expectedViewBounds, view.Viewport);
     }
 
@@ -44,7 +41,6 @@ public class AutoSizeFalseTests (ITestOutputHelper output)
         frame.LayoutSubviews ();
 
         Assert.Equal (5, text.Length);
-        Assert.False (view.AutoSize);
         Assert.Equal (new (0, 0, 3, 1), view.Frame);
         Assert.Equal (new (3, 1), view.TextFormatter.Size);
         Assert.Equal (new() { "Vie" }, view.TextFormatter.GetLines ());
@@ -118,8 +114,6 @@ public class AutoSizeFalseTests (ITestOutputHelper output)
         top.BeginInit ();
         top.EndInit ();
 
-        Assert.False (horizontalView.AutoSize);
-        Assert.False (verticalView.AutoSize);
         Assert.Equal (new (0, 0, 20, 1), horizontalView.Frame);
         Assert.Equal (new (0, 3, 1, 20), verticalView.Frame);
 

Diferenças do arquivo suprimidas por serem muito extensas
+ 51 - 578
UnitTests/View/Text/AutoSizeTrueTests.cs


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff