Browse Source

Added failing test.

`ItemsPresenter.Items` isn't correctly in sync with `ItemsControl.Items` when assigning new `Items`.
pull/3177/head
Steven Kirk 7 years ago
parent
commit
96619e4440
  1. 30
      tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs

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

@ -522,6 +522,36 @@ namespace Avalonia.Controls.UnitTests
}
}
[Fact]
public void Presenter_Items_Should_Be_In_Sync()
{
var target = new ItemsControl
{
Template = GetTemplate(),
Items = new object[]
{
new Button(),
new Button(),
},
};
var root = new TestRoot { Child = target };
var otherPanel = new StackPanel();
target.ApplyTemplate();
target.Presenter.ApplyTemplate();
target.ItemContainerGenerator.Materialized += (s, e) =>
{
Assert.IsType<Canvas>(e.Containers[0].Item);
};
target.Items = new[]
{
new Canvas()
};
}
private class Item
{
public Item(string value)

Loading…
Cancel
Save