From 667c17af4bee4a4ccd6f86be8f2024ba7472eb70 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 3 Mar 2016 09:05:39 +0100 Subject: [PATCH] Removed leak tests and added failing test. These were from a time when templates were applied when attached/detached from visual tree. Template controls are now retained until another template is applied. --- tests/Perspex.LeakTests/ControlTests.cs | 67 +------------------------ 1 file changed, 1 insertion(+), 66 deletions(-) diff --git a/tests/Perspex.LeakTests/ControlTests.cs b/tests/Perspex.LeakTests/ControlTests.cs index 7d34613c86..1577628c94 100644 --- a/tests/Perspex.LeakTests/ControlTests.cs +++ b/tests/Perspex.LeakTests/ControlTests.cs @@ -9,6 +9,7 @@ using Perspex.Controls; using Perspex.Controls.Primitives; using Perspex.Controls.Templates; using Perspex.Layout; +using Perspex.Styling; using Perspex.UnitTests; using Perspex.VisualTree; using Xunit; @@ -90,39 +91,6 @@ namespace Perspex.LeakTests } } - [Fact] - public void Templated_Child_Is_Freed_When_Template_Cleared() - { - using (UnitTestApplication.Start(TestServices.StyledWindow)) - { - Func run = () => - { - var window = new Window - { - Content = new TestTemplatedControl() - }; - - // Do a layout and make sure that the control gets added to visual tree and its - // template applied. - LayoutManager.Instance.ExecuteInitialLayoutPass(window); - Assert.IsType(window.Presenter.Child); - Assert.IsType(window.Presenter.Child.GetVisualChildren().SingleOrDefault()); - - // Clear the template and ensure the control template gets removed - ((TestTemplatedControl)window.Content).Template = null; - LayoutManager.Instance.ExecuteLayoutPass(); - Assert.Equal(0, window.Presenter.Child.GetVisualChildren().Count()); - - return window; - }; - - var result = run(); - - dotMemory.Check(memory => - Assert.Equal(0, memory.GetObjects(where => where.Type.Is()).ObjectsCount)); - } - } - [Fact] public void ScrollViewer_With_Content_Is_Freed() { @@ -239,39 +207,6 @@ namespace Perspex.LeakTests } } - [Fact] - public void TextBox_ScrollViewer_Is_Freed_When_Template_Cleared() - { - using (UnitTestApplication.Start(TestServices.StyledWindow)) - { - Func run = () => - { - var window = new Window - { - Content = new TextBox() - }; - - // Do a layout and make sure that TextBox gets added to visual tree and its - // template applied. - LayoutManager.Instance.ExecuteInitialLayoutPass(window); - Assert.IsType(window.Presenter.Child); - Assert.NotEqual(0, window.Presenter.Child.GetVisualChildren().Count()); - - // Clear the template and ensure the TextBox template gets removed - ((TextBox)window.Content).Template = null; - LayoutManager.Instance.ExecuteLayoutPass(); - Assert.Equal(0, window.Presenter.Child.GetVisualChildren().Count()); - - return window; - }; - - var result = run(); - - dotMemory.Check(memory => - Assert.Equal(0, memory.GetObjects(where => where.Type.Is()).ObjectsCount)); - } - } - [Fact] public void TreeView_Is_Freed() {