From 4df55f733d3624a953227677431427aa8b488ac0 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 4 Jul 2019 21:12:24 +0300 Subject: [PATCH] Manually manage the name scope for control leak tests --- tests/Avalonia.LeakTests/ControlTests.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/Avalonia.LeakTests/ControlTests.cs b/tests/Avalonia.LeakTests/ControlTests.cs index 50cf392c7d..d1fadd3281 100644 --- a/tests/Avalonia.LeakTests/ControlTests.cs +++ b/tests/Avalonia.LeakTests/ControlTests.cs @@ -67,13 +67,14 @@ namespace Avalonia.LeakTests { Func 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);