Browse Source

Manually manage the name scope for control leak tests

pull/2705/head
Nikita Tsukanov 7 years ago
parent
commit
4df55f733d
  1. 6
      tests/Avalonia.LeakTests/ControlTests.cs

6
tests/Avalonia.LeakTests/ControlTests.cs

@ -67,13 +67,14 @@ namespace Avalonia.LeakTests
{
Func<Window> run = () =>
{
var scope = new NameScope();
var window = new Window
{
Content = new Canvas
{
Name = "foo"
}
};
}.RegisterInNameScope(scope)
}.WithNameScope(scope);
window.Show();
@ -84,6 +85,7 @@ namespace Avalonia.LeakTests
// Clear the content and ensure the Canvas is removed.
window.Content = null;
scope.Unregister("foo");
window.LayoutManager.ExecuteLayoutPass();
Assert.Null(window.Presenter.Child);

Loading…
Cancel
Save