Browse Source

Added failing test for #2420.

pull/2438/head
Steven Kirk 7 years ago
parent
commit
3992e0e855
  1. 33
      tests/Avalonia.LeakTests/ControlTests.cs

33
tests/Avalonia.LeakTests/ControlTests.cs

@ -308,6 +308,39 @@ namespace Avalonia.LeakTests
}
[Fact]
public void Slider_Is_Freed()
{
using (Start())
{
Func<Window> run = () =>
{
var window = new Window
{
Content = new Slider()
};
window.Show();
// Do a layout and make sure that Slider gets added to visual tree.
window.LayoutManager.ExecuteInitialLayoutPass(window);
Assert.IsType<Slider>(window.Presenter.Child);
// Clear the content and ensure the Slider is removed.
window.Content = null;
window.LayoutManager.ExecuteLayoutPass();
Assert.Null(window.Presenter.Child);
return window;
};
var result = run();
dotMemory.Check(memory =>
Assert.Equal(0, memory.GetObjects(where => where.Type.Is<Slider>()).ObjectsCount));
}
}
[Fact]
public void RendererIsDisposed()
{

Loading…
Cancel
Save