LayoutManagerTests.cs 1.2 KB

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