From d8d899f3db21554453aa534ca70f3472b0da3073 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 26 Jun 2024 15:01:27 -0500 Subject: [PATCH] WIP: tests that pass Somehow these pass, but the sample here has an issue: * https://github.com/dotnet/maui/issues/23199 Past links related to `RadioButton`: * https://github.com/dotnet/maui/issues/18365 * https://github.com/dotnet/maui/pull/21151 --- .../Elements/NavigationPage/NavigationPageTests.cs | 6 +++++- src/Controls/tests/DeviceTests/Memory/MemoryTests.cs | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.cs b/src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.cs index 43bccb1d2ad7..7b7a2953ee07 100644 --- a/src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.cs @@ -358,7 +358,11 @@ public async Task ChildPagesDoNotLeak() new ContentView(), new Label(), new ScrollView(), - new RadioButton(), + new RadioButton + { + ControlTemplate = new ControlTemplate(() => + new Border { Content = new Grid { Children = { new ContentPresenter() } } }) + } } }; NavigationPage.SetTitleView(page, new Label() { Text = "Title View" }); diff --git a/src/Controls/tests/DeviceTests/Memory/MemoryTests.cs b/src/Controls/tests/DeviceTests/Memory/MemoryTests.cs index 87b47ce0f66a..3e009fb138c0 100644 --- a/src/Controls/tests/DeviceTests/Memory/MemoryTests.cs +++ b/src/Controls/tests/DeviceTests/Memory/MemoryTests.cs @@ -37,6 +37,7 @@ void SetupBuilder() handlers.AddHandler(); handlers.AddHandler(); handlers.AddHandler(); + handlers.AddHandler(); handlers.AddHandler(); handlers.AddHandler(); handlers.AddHandler(); @@ -45,6 +46,7 @@ void SetupBuilder() handlers.AddHandler(); handlers.AddHandler(); handlers.AddHandler(); + handlers.AddHandler(); handlers.AddHandler(); handlers.AddHandler(); handlers.AddHandler(); @@ -135,6 +137,7 @@ public async Task PagesDoNotLeak(Type type) [InlineData(typeof(Editor))] [InlineData(typeof(Frame))] [InlineData(typeof(GraphicsView))] + [InlineData(typeof(Grid))] [InlineData(typeof(Image))] [InlineData(typeof(ImageButton))] [InlineData(typeof(IndicatorView))] @@ -143,6 +146,7 @@ public async Task PagesDoNotLeak(Type type) [InlineData(typeof(Picker))] [InlineData(typeof(Polygon))] [InlineData(typeof(Polyline))] + [InlineData(typeof(RadioButton))] [InlineData(typeof(RefreshView))] [InlineData(typeof(ScrollView))] [InlineData(typeof(SearchBar))] @@ -214,6 +218,11 @@ public async Task HandlerDoesNotLeak(Type type) webView.Source = new HtmlWebViewSource { Html = "

hi

" }; await Task.Delay(1000); } + else if (view is TemplatedView templated) + { + templated.ControlTemplate = new ControlTemplate(() => + new Border { Content = new Grid { Children = { new ContentPresenter() } } }); + } var handler = CreateHandler(layout); viewReference = new WeakReference(view); handlerReference = new WeakReference(view.Handler);