|
|
|
@ -82,5 +82,55 @@ namespace Avalonia.Controls.UnitTests |
|
|
|
Assert.Equal(new Rect(0, 0, 20, 20), target.Children[0].Bounds); |
|
|
|
Assert.Equal(new Rect(0, 20, 20, 20), target.Children[1].Bounds); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void LeftOf_Measures_Correctly() |
|
|
|
{ |
|
|
|
var rect1 = new Rectangle { Height = 20, Width = 20 }; |
|
|
|
var rect2 = new Rectangle { Height = 20, Width = 20 }; |
|
|
|
|
|
|
|
var target = new RelativePanel |
|
|
|
{ |
|
|
|
VerticalAlignment = Layout.VerticalAlignment.Center, |
|
|
|
HorizontalAlignment = Layout.HorizontalAlignment.Center, |
|
|
|
Children = |
|
|
|
{ |
|
|
|
rect1, rect2 |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
RelativePanel.SetLeftOf(rect2, rect1); |
|
|
|
target.Measure(new Size(400, 400)); |
|
|
|
target.Arrange(new Rect(target.DesiredSize)); |
|
|
|
|
|
|
|
Assert.Equal(new Size(20, 20), target.Bounds.Size); |
|
|
|
Assert.Equal(new Rect(0, 0, 20, 20), target.Children[0].Bounds); |
|
|
|
Assert.Equal(new Rect(-20, 0, 20, 20), target.Children[1].Bounds); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Above_Measures_Correctly() |
|
|
|
{ |
|
|
|
var rect1 = new Rectangle { Height = 20, Width = 20 }; |
|
|
|
var rect2 = new Rectangle { Height = 20, Width = 20 }; |
|
|
|
|
|
|
|
var target = new RelativePanel |
|
|
|
{ |
|
|
|
VerticalAlignment = Layout.VerticalAlignment.Center, |
|
|
|
HorizontalAlignment = Layout.HorizontalAlignment.Center, |
|
|
|
Children = |
|
|
|
{ |
|
|
|
rect1, rect2 |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
RelativePanel.SetAbove(rect2, rect1); |
|
|
|
target.Measure(new Size(400, 400)); |
|
|
|
target.Arrange(new Rect(target.DesiredSize)); |
|
|
|
|
|
|
|
Assert.Equal(new Size(20, 20), target.Bounds.Size); |
|
|
|
Assert.Equal(new Rect(0, 0, 20, 20), target.Children[0].Bounds); |
|
|
|
Assert.Equal(new Rect(0, -20, 20, 20), target.Children[1].Bounds); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|