Browse Source
Merge branch 'master' into fixes/textProcessingBugs
pull/8094/head
Max Katz
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
28 additions and
0 deletions
-
src/Avalonia.Controls/Viewbox.cs
-
tests/Avalonia.Controls.UnitTests/ViewboxTests.cs
|
|
|
@ -168,6 +168,8 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
if (_child is not null) |
|
|
|
VisualChildren.Add(_child); |
|
|
|
|
|
|
|
InvalidateMeasure(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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) |
|
|
|
|