RelativePanelTests.cs 972 B

1234567891011121314151617181920212223242526272829303132
  1. using Avalonia.Controls.Shapes;
  2. using Xunit;
  3. namespace Avalonia.Controls.UnitTests
  4. {
  5. public class RelativePanelTests
  6. {
  7. [Fact]
  8. public void Lays_Out_1_Child_Below_the_other()
  9. {
  10. var rect1 = new Rectangle { Height = 20, Width = 20 };
  11. var rect2 = new Rectangle { Height = 20, Width = 20 };
  12. var target = new RelativePanel
  13. {
  14. Children =
  15. {
  16. rect1, rect2
  17. }
  18. };
  19. RelativePanel.SetAlignLeftWithPanel(rect1 , true);
  20. RelativePanel.SetBelow(rect2, rect1);
  21. target.Measure(new Size(400, 400));
  22. target.Arrange(new Rect(target.DesiredSize));
  23. Assert.Equal(new Size(20, 40), target.Bounds.Size);
  24. Assert.Equal(new Rect(0, 0, 20, 20), target.Children[0].Bounds);
  25. Assert.Equal(new Rect(0, 20, 20, 20), target.Children[1].Bounds);
  26. }
  27. }
  28. }