mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Fixed more tests
This commit is contained in:
@@ -640,14 +640,14 @@ public class DimAutoTests
|
||||
|
||||
var view = new View ()
|
||||
{
|
||||
Text = "01234567",
|
||||
Width = Auto (DimAutoStyle.Text),
|
||||
Height = Auto (DimAutoStyle.Text),
|
||||
Text = "New text"
|
||||
};
|
||||
Rectangle expectedViewport = new (0, 0, 8, 1);
|
||||
Assert.Equal (expectedViewport, view.Viewport);
|
||||
|
||||
super.Add (view);
|
||||
|
||||
Rectangle expectedViewport = new (0, 0, 8, 1);
|
||||
Assert.Equal (expectedViewport, view.Viewport);
|
||||
|
||||
super.LayoutSubviews ();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Xunit.Abstractions;
|
||||
using static Terminal.Gui.Pos;
|
||||
|
||||
namespace Terminal.Gui.ViewTests;
|
||||
|
||||
@@ -209,29 +210,6 @@ public class AutoSizeFalseTests
|
||||
Assert.Equal ("Absolute(1)", view.Height.ToString ());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AutoSize_False_Text_Does_Not_Change_Size ()
|
||||
{
|
||||
var view = new View { Width = Dim.Fill (), Height = Dim.Fill () };
|
||||
|
||||
view.SetRelativeLayout (new (10, 4));
|
||||
Assert.Equal (new (0, 0, 10, 4), view.Frame);
|
||||
Assert.Equal (new (0, 0), view.TextFormatter.Size);
|
||||
Assert.False (view.AutoSize);
|
||||
Assert.True (view.TextFormatter.NeedsFormat);
|
||||
Assert.Equal (string.Empty, view.TextFormatter.Format ()); // There's no size, so it returns an empty string
|
||||
Assert.False (view.TextFormatter.NeedsFormat);
|
||||
Assert.Single (view.TextFormatter.GetLines ());
|
||||
Assert.True (string.IsNullOrEmpty (view.TextFormatter.GetLines () [0]));
|
||||
|
||||
view.Text = "Views";
|
||||
Assert.True (view.TextFormatter.NeedsFormat);
|
||||
Assert.Equal (new (0, 0), view.TextFormatter.Size);
|
||||
Assert.Equal (string.Empty, view.TextFormatter.Format ()); // There's no size, so it returns an empty string
|
||||
Assert.False (view.TextFormatter.NeedsFormat);
|
||||
Assert.Single (view.TextFormatter.GetLines ());
|
||||
Assert.True (string.IsNullOrEmpty (view.TextFormatter.GetLines () [0]));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SetupFakeDriver]
|
||||
|
||||
@@ -1746,7 +1746,7 @@ Y
|
||||
// Setting to false causes Width and Height to be set to the current ContentSize
|
||||
view.AutoSize = false;
|
||||
|
||||
Assert.Equal (new Rectangle (0, 0, 1, 12), view.Frame);
|
||||
Assert.Equal (new Rectangle (0, 0, 12, 12), view.Frame);
|
||||
|
||||
view.Height = 1;
|
||||
view.Width = 12;
|
||||
|
||||
@@ -160,8 +160,7 @@ public class ViewTests
|
||||
{
|
||||
Assert.True (v.AutoSize);
|
||||
Assert.False (v.CanFocus);
|
||||
// The text is 100 characters long, but Dim.Auto constrains to SuperView, so it should be truncated.
|
||||
Assert.Equal (new Rectangle (0, 0, 100, 1), v.Frame);
|
||||
Assert.Equal (new Rectangle (0, 0, 20, 1), v.Frame);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user