public void Arrange_With_IsMeasureValid_False_Calls_Measure_With_Previous_Size_If_Available() { var target = new TestControl(); Assert.False(target.IsMeasureValid); target.Arrange(new Rect(0, 0, 120, 120)); target.InvalidateMeasure(); target.Arrange(new Rect(0, 0, 100, 100)); Assert.True(target.IsMeasureValid); Assert.Equal(new Size(120, 120), target.MeasureConstraint); }
public void Margin_Should_Be_Subtracted_From_Arrange_FinalSize() { var target = new TestControl { Width = 100, Height = 100, Margin = new Thickness(8), }; target.Measure(Size.Infinity); target.Arrange(new Rect(target.DesiredSize)); Assert.Equal(new Size(100, 100), target.ArrangeFinalSize); }
public void ArrangeOverride_Receives_Requested_Size_When_Arranged_To_DesiredSize() { var target = new TestControl { MeasureResult = new Size(100, 100), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(8), }; target.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); target.Arrange(new Rect(target.DesiredSize)); Assert.Equal(new Size(100, 100), target.ArrangeFinalSize); }
public void ArrangeOverride_Receives_Available_Size_Minus_Margin_When_Stretched() { var target = new TestControl { MeasureResult = new Size(100, 100), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Margin = new Thickness(8), }; target.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); target.Arrange(new Rect(0, 0, 200, 200)); Assert.Equal(new Size(184, 184), target.ArrangeFinalSize); }