Files
Terminal.Gui/Tests/UnitTests/View/Adornment/PaddingTests.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

39 lines
1.1 KiB
C#

using UnitTests;
using Xunit.Abstractions;
namespace Terminal.Gui.ViewTests;
public class PaddingTests (ITestOutputHelper output)
{
[Fact]
[SetupFakeDriver]
public void Padding_Uses_Parent_ColorScheme ()
{
((FakeDriver)Application.Driver!).SetBufferSize (5, 5);
var view = new View { Height = 3, Width = 3 };
view.Padding!.Thickness = new (1);
view.Padding.Diagnostics = ViewDiagnosticFlags.Thickness;
view.ColorScheme = new()
{
Normal = new (Color.Red, Color.Green), Focus = new (Color.Green, Color.Red)
};
Assert.Equal (ColorName16.Red, view.Padding.GetNormalColor ().Foreground.GetClosestNamedColor16 ());
Assert.Equal (view.GetNormalColor (), view.Padding.GetNormalColor ());
view.BeginInit ();
view.EndInit ();
view.Draw ();
DriverAssert.AssertDriverContentsAre (
@"
PPP
P P
PPP",
output
);
DriverAssert.AssertDriverAttributesAre ("0", output, null, view.GetNormalColor ());
}
}