DrawEventTests.cs 812 B

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