|
|
|
@ -513,6 +513,41 @@ namespace Avalonia.Controls.UnitTests |
|
|
|
Assert.Same(before, after); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Control_Item_Should_Be_Removed_From_LogicalChildren() |
|
|
|
{ |
|
|
|
using var app = Start(); |
|
|
|
var item = new Border(); |
|
|
|
|
|
|
|
var items = new ObservableCollection<Control>(); |
|
|
|
var target = CreateTarget(itemsSource: items); |
|
|
|
|
|
|
|
items.Add(item); |
|
|
|
items.Remove(item); |
|
|
|
|
|
|
|
Assert.Empty(target.LogicalChildren); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Control_Item_Should_Be_Removed_From_LogicalChildren_Virtualizing() |
|
|
|
{ |
|
|
|
using var app = Start(); |
|
|
|
var item = new Border(); |
|
|
|
|
|
|
|
var items = new ObservableCollection<Control>(); |
|
|
|
var itemsPanel = new FuncTemplate<Panel?>(() => new VirtualizingStackPanel()); |
|
|
|
var target = CreateTarget( |
|
|
|
itemsPanel: itemsPanel, |
|
|
|
itemsSource: items); |
|
|
|
|
|
|
|
items.Add(item); |
|
|
|
Layout(target); |
|
|
|
|
|
|
|
items.Remove(item); |
|
|
|
|
|
|
|
Assert.Empty(target.LogicalChildren); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Should_Clear_Containers_When_ItemsPresenter_Changes() |
|
|
|
{ |
|
|
|
|