SetLayoutTests.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using UnitTests;
  2. using Xunit.Abstractions;
  3. namespace Terminal.Gui.LayoutTests;
  4. public class SetLayoutTests (ITestOutputHelper output)
  5. {
  6. private readonly ITestOutputHelper _output = output;
  7. [Fact]
  8. [AutoInitShutdown]
  9. public void Screen_Size_Change_Causes_Layout ()
  10. {
  11. Application.Top = new ();
  12. var view = new View
  13. {
  14. X = 3,
  15. Y = 2,
  16. Width = 10,
  17. Height = 1,
  18. Text = "0123456789"
  19. };
  20. Application.Top.Add (view);
  21. var rs = Application.Begin (Application.Top);
  22. Assert.Equal (new (0, 0, 80, 25), new Rectangle (0, 0, View.Driver.Cols, View.Driver.Rows));
  23. Assert.Equal (new (0, 0, View.Driver.Cols, View.Driver.Rows), Application.Top.Frame);
  24. Assert.Equal (new (0, 0, 80, 25), Application.Top.Frame);
  25. ((FakeDriver)Application.Driver!).SetBufferSize (20, 10);
  26. Assert.Equal (new (0, 0, View.Driver.Cols, View.Driver.Rows), Application.Top.Frame);
  27. Assert.Equal (new (0, 0, 20, 10), Application.Top.Frame);
  28. Application.End (rs);
  29. }
  30. }