Browse Source

Merge branch 'master' into fixes/textProcessingBugs

pull/8094/head
Max Katz 4 years ago
committed by GitHub
parent
commit
6c3ec544f4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Avalonia.Controls/Viewbox.cs
  2. 26
      tests/Avalonia.Controls.UnitTests/ViewboxTests.cs

2
src/Avalonia.Controls/Viewbox.cs

@ -168,6 +168,8 @@ namespace Avalonia.Controls
if (_child is not null)
VisualChildren.Add(_child);
InvalidateMeasure();
}
}
}

26
tests/Avalonia.Controls.UnitTests/ViewboxTests.cs

@ -181,6 +181,32 @@ namespace Avalonia.Controls.UnitTests
Assert.Null(child.GetLogicalParent());
}
[Fact]
public void Changing_Child_Should_Invalidate_Layout()
{
var target = new Viewbox();
target.Child = new Canvas
{
Width = 100,
Height = 100,
};
target.Measure(Size.Infinity);
target.Arrange(new Rect(target.DesiredSize));
Assert.Equal(new Size(100, 100), target.DesiredSize);
target.Child = new Canvas
{
Width = 200,
Height = 200,
};
target.Measure(Size.Infinity);
target.Arrange(new Rect(target.DesiredSize));
Assert.Equal(new Size(200, 200), target.DesiredSize);
}
private bool TryGetScale(Viewbox viewbox, out Vector scale)
{
if (viewbox.InternalTransform is null)

Loading…
Cancel
Save