Files
Terminal.Gui/Tests/UnitTests/View/Adornment/MarginTests.cs
Tig acb5979e6c Cleans up/Refactors View.Subviews (#3962)
* Subview clean up

* New Add/Remove event pattern

* Using Logging

* cleanup

* Subview -> SubView

* Test code cleanup. Killed many warnings.

* Fix tznind feedback

* Refactored AllViewTest helpers

* Moved keyboard tests to parallel

* Moved mouse tests to parallel

* Moved view tests to parallel

* Test code cleanup. Killed many warnings.

* dupe test

* Some mouse tests can't run in parallel because MouseGrabView

* Made SpinnerView more testable

* Moved more tests

* SubViews to IReadOnlyCollection<View>

* SubViews to IReadOnlyCollection<View> 2

* scrollbar tests

* shortcut tests

* Use InternalSubViews vs. _subviews

* Nuked View.IsAdded.
Added View.SuperViewChanged.

* API doc updats

* Unit Test tweak

* Unit Test tweak
2025-03-08 15:42:17 -07:00

46 lines
1.4 KiB
C#

using UnitTests;
using Xunit.Abstractions;
namespace Terminal.Gui.ViewTests;
public class MarginTests (ITestOutputHelper output)
{
[Fact]
[SetupFakeDriver]
public void Margin_Is_Transparent ()
{
((FakeDriver)Application.Driver!).SetBufferSize (5, 5);
var view = new View { Height = 3, Width = 3 };
view.Margin!.Diagnostics = ViewDiagnosticFlags.Thickness;
view.Margin.Thickness = new (1);
Application.Top = new Toplevel ();
Application.TopLevels.Push (Gui.Application.Top);
Application.Top.ColorScheme = new()
{
Normal = new (Color.Red, Color.Green), Focus = new (Color.Green, Color.Red)
};
Application.Top.Add (view);
Assert.Equal (ColorName16.Red, view.Margin.GetNormalColor ().Foreground.GetClosestNamedColor16 ());
Assert.Equal (ColorName16.Red, Application.Top.GetNormalColor ().Foreground.GetClosestNamedColor16 ());
Application.Top.BeginInit ();
Application.Top.EndInit ();
Application.LayoutAndDraw();
DriverAssert.AssertDriverContentsAre (
@"
MMM
M M
MMM",
output
);
DriverAssert.AssertDriverAttributesAre ("0", output, null, Application.Top.GetNormalColor ());
Application.ResetState (true);
}
}