Skip to content

Commit

Permalink
chore(autolayout): add test for collapsed
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-Louis committed Aug 2, 2023
1 parent 5dfeeab commit fc559cb
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/Uno.Toolkit.RuntimeTests/Tests/AutoLayoutTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,38 @@ namespace Uno.Toolkit.RuntimeTests.Tests;
[RunsOnUIThread]
internal class AutoLayoutTest
{
[TestMethod]
[RequiresFullWindow]
public async Task When_collapsed()
{
var SUT = new AutoLayout()
{
Padding = new Thickness(20),
Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0))
};

var border1 = new Border() { Visibility = Visibility.Collapsed, Width = 100, Height = 100, Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 255)) };
var border2 = new Border() { Width = 100, Height = 100, Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 255)) };

SUT.Children.Add(border1);
SUT.Children.Add(border2);

await UnitTestUIContentHelperEx.SetContentAndWait(SUT);

var layoutRect0Actual = LayoutInformation.GetLayoutSlot(SUT.Children[0] as FrameworkElement);
var layoutRect1Actual = LayoutInformation.GetLayoutSlot(SUT.Children[1] as FrameworkElement);

layoutRect0Actual.Width.Should().Be(0);
layoutRect0Actual.Height.Should().Be(0);
layoutRect0Actual.X.Should().Be(0);
layoutRect0Actual.Y.Should().Be(0);

layoutRect1Actual.Width.Should().Be(100);
layoutRect1Actual.Height.Should().Be(100);
layoutRect1Actual.X.Should().Be(20);
layoutRect1Actual.Y.Should().Be(20);
}

[TestMethod]
[RequiresFullWindow]
[DataRow(Orientation.Vertical, 10, 130, 250)]
Expand Down

0 comments on commit fc559cb

Please sign in to comment.