예제 #1
0
        public void Child_Should_Be_Measured_With_Infinity()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var child  = new ChildControl();
                var window = new Window();
                var target = CreateTarget(window);

                target.Content = child;
                target.Show();

                Assert.Equal(Size.Infinity, child.MeasureSize);
            }
        }
예제 #2
0
        public void Child_Should_Be_Measured_With_MaxWidth_MaxHeight_When_Set()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var child  = new ChildControl();
                var window = new Window();
                var target = CreateTarget(window);

                target.MaxWidth  = 500;
                target.MaxHeight = 600;
                target.Content   = child;
                target.Show();

                Assert.Equal(new Size(500, 600), child.MeasureSize);
            }
        }
예제 #3
0
        public void Child_Should_Be_Measured_With_MaxAutoSizeHint()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var child     = new ChildControl();
                var window    = new Window();
                var popupImpl = MockWindowingPlatform.CreatePopupMock(window.PlatformImpl);
                popupImpl.Setup(x => x.MaxAutoSizeHint).Returns(new Size(1200, 1000));
                var target = CreateTarget(window, popupImpl.Object);

                target.Content = child;
                target.Show();

                Assert.Equal(1, child.MeasureSizes.Count);
                Assert.Equal(new Size(1200, 1000), child.MeasureSizes[0]);
            }
        }