PaddingTests.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Xunit.Abstractions;
  2. namespace Terminal.Gui.ViewTests;
  3. public class PaddingTests (ITestOutputHelper output)
  4. {
  5. [Fact]
  6. [SetupFakeDriver]
  7. public void Padding_Uses_Parent_ColorScheme ()
  8. {
  9. ((FakeDriver)Application.Driver!).SetBufferSize (5, 5);
  10. var view = new View { Height = 3, Width = 3 };
  11. view.Padding.Thickness = new (1);
  12. view.Padding.Diagnostics = ViewDiagnosticFlags.Thickness;
  13. view.ColorScheme = new()
  14. {
  15. Normal = new (Color.Red, Color.Green), Focus = new (Color.Green, Color.Red)
  16. };
  17. Assert.Equal (ColorName16.Red, view.Padding.GetNormalColor ().Foreground.GetClosestNamedColor16 ());
  18. Assert.Equal (view.GetNormalColor (), view.Padding.GetNormalColor ());
  19. view.BeginInit ();
  20. view.EndInit ();
  21. view.Draw ();
  22. TestHelpers.AssertDriverContentsAre (
  23. @"
  24. PPP
  25. P P
  26. PPP",
  27. output
  28. );
  29. TestHelpers.AssertDriverAttributesAre ("0", output, null, view.GetNormalColor ());
  30. }
  31. }