mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* Refactored test namespaces. Moved some tests that were in wrong project. Code cleanup * Parrallel -> Parallel
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using UnitTests;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace UnitTests.ViewTests;
|
|
|
|
public class PaddingTests (ITestOutputHelper output)
|
|
{
|
|
[Fact]
|
|
[SetupFakeDriver]
|
|
public void Padding_Uses_Parent_Scheme ()
|
|
{
|
|
((IFakeConsoleDriver)Application.Driver!).SetBufferSize (5, 5);
|
|
var view = new View { Height = 3, Width = 3 };
|
|
view.Padding!.Thickness = new (1);
|
|
view.Padding.Diagnostics = ViewDiagnosticFlags.Thickness;
|
|
|
|
view.SetScheme (new()
|
|
{
|
|
Normal = new (Color.Red, Color.Green), Focus = new (Color.Green, Color.Red)
|
|
});
|
|
|
|
Assert.Equal (ColorName16.Red, view.Padding.GetAttributeForRole (VisualRole.Normal).Foreground.GetClosestNamedColor16 ());
|
|
Assert.Equal (view.GetAttributeForRole (VisualRole.Normal), view.Padding.GetAttributeForRole (VisualRole.Normal));
|
|
|
|
view.BeginInit ();
|
|
view.EndInit ();
|
|
view.Draw ();
|
|
|
|
DriverAssert.AssertDriverContentsAre (
|
|
@"
|
|
PPP
|
|
P P
|
|
PPP",
|
|
output
|
|
);
|
|
DriverAssert.AssertDriverAttributesAre ("0", output, null, view.GetAttributeForRole (VisualRole.Normal));
|
|
}
|
|
}
|