LayoutManagerTests.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) The Perspex Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using Perspex.Controls;
  4. using Xunit;
  5. namespace Perspex.Layout.UnitTests
  6. {
  7. public class LayoutManagerTests
  8. {
  9. [Fact]
  10. public void Invalidating_Child_Should_Remeasure_Parent()
  11. {
  12. Border border;
  13. StackPanel panel;
  14. var root = new TestLayoutRoot
  15. {
  16. Child = panel = new StackPanel
  17. {
  18. Children = new Controls.Controls
  19. {
  20. (border = new Border())
  21. }
  22. }
  23. };
  24. root.LayoutManager.ExecuteLayoutPass();
  25. Assert.Equal(new Size(0, 0), root.DesiredSize);
  26. border.Width = 100;
  27. border.Height = 100;
  28. root.LayoutManager.ExecuteLayoutPass();
  29. Assert.Equal(new Size(100, 100), panel.DesiredSize);
  30. }
  31. }
  32. }