Files
Terminal.Gui/Tests/UnitTests/View/Adornment/AdornmentTests.cs
Tig fdeaa8331b Fixes #4298 - Updates test namespaces (#4299)
* Refactored test namespaces.
Moved some tests that were in wrong project.
Code cleanup

* Parrallel -> Parallel
2025-10-20 14:14:38 -06:00

74 lines
2.0 KiB
C#

using UnitTests;
using Xunit.Abstractions;
namespace UnitTests.ViewTests;
public class AdornmentTests (ITestOutputHelper output)
{
[Fact]
[SetupFakeDriver]
public void Border_Is_Cleared_After_Margin_Thickness_Change ()
{
View view = new () { Text = "View", Width = 6, Height = 3, BorderStyle = LineStyle.Rounded };
// Remove border bottom thickness
view.Border!.Thickness = new (1, 1, 1, 0);
// Add margin bottom thickness
view.Margin!.Thickness = new (0, 0, 0, 1);
Assert.Equal (6, view.Width);
Assert.Equal (3, view.Height);
view.Draw ();
DriverAssert.AssertDriverContentsWithFrameAre (
@"
╭────╮
│View│
",
output
);
// Add border bottom thickness
view.Border!.Thickness = new (1, 1, 1, 1);
// Remove margin bottom thickness
view.Margin!.Thickness = new (0, 0, 0, 0);
view.Draw ();
Assert.Equal (6, view.Width);
Assert.Equal (3, view.Height);
DriverAssert.AssertDriverContentsWithFrameAre (
@"
╭────╮
│View│
╰────╯
",
output
);
// Remove border bottom thickness
view.Border!.Thickness = new (1, 1, 1, 0);
// Add margin bottom thickness
view.Margin!.Thickness = new (0, 0, 0, 1);
Assert.Equal (6, view.Width);
Assert.Equal (3, view.Height);
View.SetClipToScreen ();
view.Draw ();
DriverAssert.AssertDriverContentsWithFrameAre (
@"
╭────╮
│View│
",
output
);
}
}