Browse Source

Added failing test for #3487.

pull/3546/head
Steven Kirk 7 years ago
parent
commit
632c40340a
  1. 24
      tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs

24
tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs

@ -575,6 +575,30 @@ namespace Avalonia.Controls.UnitTests
};
}
[Fact]
public void Detaching_Then_Reattaching_To_Logical_Tree_Twice_Does_Not_Throw()
{
// # Issue 3487
var target = new ItemsControl
{
Template = GetTemplate(),
Items = new[] { "foo", "bar" },
ItemTemplate = new FuncDataTemplate<string>((_, __) => new Canvas()),
};
var root = new TestRoot(target);
root.Measure(Size.Infinity);
root.Arrange(new Rect(root.DesiredSize));
root.Child = null;
root.Child = target;
target.Measure(Size.Infinity);
root.Child = null;
root.Child = target;
}
private class Item
{
public Item(string value)

Loading…
Cancel
Save