DrawEventTests.cs 869 B

1234567891011121314151617181920212223242526272829303132
  1. #nullable enable
  2. using System.Text;
  3. using Xunit.Abstractions;
  4. namespace Terminal.Gui.ViewTests;
  5. [Trait ("Category", "Output")]
  6. public class DrawEventTests (ITestOutputHelper _output)
  7. {
  8. [Fact]
  9. [AutoInitShutdown]
  10. public void DrawContentComplete_Event_Is_Always_Called ()
  11. {
  12. var viewCalled = false;
  13. var tvCalled = false;
  14. var view = new View { Width = 10, Height = 10, Text = "View" };
  15. view.DrawComplete += (s, e) => viewCalled = true;
  16. var tv = new TextView { Y = 11, Width = 10, Height = 10 };
  17. tv.DrawComplete += (s, e) => tvCalled = true;
  18. var top = new Toplevel ();
  19. top.Add (view, tv);
  20. RunState runState = Application.Begin (top);
  21. Application.RunIteration (ref runState);
  22. Assert.True (viewCalled);
  23. Assert.True (tvCalled);
  24. top.Dispose ();
  25. }
  26. }