Browse Source

Add failing unit tests for border and content presenter.

pull/1497/head
Dan Walmsley 8 years ago
parent
commit
67003577a0
  1. 23
      tests/Avalonia.Controls.UnitTests/BorderTests.cs
  2. 23
      tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Layout.cs

23
tests/Avalonia.Controls.UnitTests/BorderTests.cs

@ -20,5 +20,28 @@ namespace Avalonia.Controls.UnitTests
Assert.Equal(new Size(20, 20), target.DesiredSize);
}
[Fact]
public void Child_Should_Arrange_With_Zero_Height_Width_If_Padding_Greater_Than_Child_Size()
{
Border content;
var target = new Border
{
Padding = new Thickness(6),
MaxHeight = 12,
MaxWidth = 12,
Content = content = new Border
{
Height = 0,
Width = 0
}
};
target.Measure(new Size(100, 100));
target.Arrange(new Rect(0, 0, 100, 100));
Assert.Equal(new Rect(0, 0, 0, 0), content.Bounds);
}
}
}

23
tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Layout.cs

@ -210,5 +210,28 @@ namespace Avalonia.Controls.UnitTests.Presenters
Assert.Equal(new Rect(84, 0, 16, 16), content.Bounds);
}
[Fact]
public void Child_Arrange_With_Zero_Height_When_Padding_Height_Greater_Than_Child_Height()
{
Border content;
var target = new ContentPresenter
{
Padding = 32,
MaxHeight = 32,
MaxWidth = 32,
Content = content = new Border
{
MinWidth = 16,
MinHeight = 16,
},
};
target.UpdateChild();
target.Measure(new Size(100, 100));
target.Arrange(new Rect(0, 0, 100, 100));
Assert.Equal(new Rect(0, 0, 0, 0), content.Bounds);
}
}
}
Loading…
Cancel
Save