|
|
@@ -146,5 +146,44 @@ namespace Avalonia.Controls.UnitTests
|
|
|
Assert.Equal(new Rect(20, 0, 30, 120), target.Children[1].Bounds);
|
|
|
Assert.Equal(new Rect(50, 0, 50, 120), target.Children[2].Bounds);
|
|
|
}
|
|
|
+
|
|
|
+ [Theory]
|
|
|
+ [InlineData(Orientation.Horizontal)]
|
|
|
+ [InlineData(Orientation.Vertical)]
|
|
|
+ public void Gap_Not_Added_For_Invisible_Children(Orientation orientation)
|
|
|
+ {
|
|
|
+ var targetThreeChildrenOneInvisble = new StackPanel
|
|
|
+ {
|
|
|
+ Gap = 40,
|
|
|
+ Orientation = orientation,
|
|
|
+ Children =
|
|
|
+ {
|
|
|
+ new StackPanel { Width = 10, Height= 10, IsVisible = false },
|
|
|
+ new StackPanel { Width = 10, Height= 10 },
|
|
|
+ new StackPanel { Width = 10, Height= 10 },
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var targetTwoChildrenNoneInvisible = new StackPanel
|
|
|
+ {
|
|
|
+ Gap = 40,
|
|
|
+ Orientation = orientation,
|
|
|
+ Children =
|
|
|
+ {
|
|
|
+ new StackPanel { Width = 10, Height= 10 },
|
|
|
+ new StackPanel { Width = 10, Height= 10 }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ targetThreeChildrenOneInvisble.Measure(Size.Infinity);
|
|
|
+ targetThreeChildrenOneInvisble.Arrange(new Rect(targetThreeChildrenOneInvisble.DesiredSize));
|
|
|
+
|
|
|
+ targetTwoChildrenNoneInvisible.Measure(Size.Infinity);
|
|
|
+ targetTwoChildrenNoneInvisible.Arrange(new Rect(targetTwoChildrenNoneInvisible.DesiredSize));
|
|
|
+
|
|
|
+ Size sizeWithTwoChildren = targetTwoChildrenNoneInvisible.Bounds.Size;
|
|
|
+ Size sizeWithThreeChildren = targetThreeChildrenOneInvisble.Bounds.Size;
|
|
|
+
|
|
|
+ Assert.Equal(sizeWithTwoChildren, sizeWithThreeChildren);
|
|
|
+ }
|
|
|
}
|
|
|
}
|