Browse Source

Added test for window max width/height.

Steven Kirk 3 years ago
parent
commit
e662a9fd43
1 changed files with 21 additions and 0 deletions
  1. 21 0
      tests/Avalonia.Controls.UnitTests/WindowTests.cs

+ 21 - 0
tests/Avalonia.Controls.UnitTests/WindowTests.cs

@@ -719,6 +719,27 @@ namespace Avalonia.Controls.UnitTests
                 }
             }
 
+            [Fact]
+            public void MaxWidth_And_MaxHeight_Should_Be_Respected_With_SizeToContent_WidthAndHeight()
+            {
+                using (UnitTestApplication.Start(TestServices.StyledWindow))
+                {
+                    var child = new ChildControl();
+
+                    var target = new Window()
+                    {
+                        SizeToContent = SizeToContent.WidthAndHeight,
+                        MaxWidth = 300,
+                        MaxHeight = 700,
+                        Content = child,
+                    };
+
+                    Show(target);
+
+                    Assert.Equal(new[] { new Size(300, 700) }, child.MeasureSizes);
+                }
+            }
+
             [Fact]
             public void SizeToContent_Should_Not_Be_Lost_On_Show()
             {