PaddingTests.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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.ColorScheme = new()
  13. {
  14. Normal = new (Color.Red, Color.Green), Focus = new (Color.Green, Color.Red)
  15. };
  16. Assert.Equal (ColorName.Red, view.Padding.GetNormalColor ().Foreground.GetClosestNamedColor ());
  17. Assert.Equal (view.GetNormalColor (), view.Padding.GetNormalColor ());
  18. view.BeginInit ();
  19. view.EndInit ();
  20. View.Diagnostics = ViewDiagnosticFlags.Padding;
  21. view.Draw ();
  22. View.Diagnostics = ViewDiagnosticFlags.Off;
  23. TestHelpers.AssertDriverContentsAre (
  24. @"
  25. PPP
  26. P P
  27. PPP",
  28. output
  29. );
  30. TestHelpers.AssertDriverAttributesAre ("0", null, view.GetNormalColor ());
  31. }
  32. }