BorderTests.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using Xunit;
  4. namespace Avalonia.Controls.UnitTests
  5. {
  6. public class BorderTests
  7. {
  8. [Fact]
  9. public void Measure_Should_Return_BorderThickness_Plus_Padding_When_No_Child_Present()
  10. {
  11. var target = new Border
  12. {
  13. Padding = new Thickness(6),
  14. BorderThickness = new Thickness(4)
  15. };
  16. target.Measure(new Size(100, 100));
  17. Assert.Equal(new Size(20, 20), target.DesiredSize);
  18. }
  19. [Fact]
  20. public void Child_Should_Arrange_With_Zero_Height_Width_If_Padding_Greater_Than_Child_Size()
  21. {
  22. Border content;
  23. var target = new Border
  24. {
  25. Padding = new Thickness(6),
  26. MaxHeight = 12,
  27. MaxWidth = 12,
  28. Child = content = new Border
  29. {
  30. Height = 0,
  31. Width = 0
  32. }
  33. };
  34. target.Arrange(new Rect(0, 0, 100, 100));
  35. Assert.Equal(new Rect(6, 6, 0, 0), content.Bounds);
  36. }
  37. }
  38. }