From b368e8b9ed3875bd7bfa51a163eb166da5322279 Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Wed, 19 Jun 2024 07:46:21 -0500 Subject: [PATCH] Use correct interface type in FrameRenderer (#23124) --- global.json | 3 +++ .../Handlers/Android/FrameRenderer.cs | 2 +- .../Tests/Issues/Issue18526.cs | 26 +++++++++++++++++++ .../tests/TestCases/Issues/Issue18526.xaml | 22 ++++++++++++++++ .../tests/TestCases/Issues/Issue18526.xaml.cs | 14 ++++++++++ 5 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18526.cs create mode 100644 src/Controls/tests/TestCases/Issues/Issue18526.xaml create mode 100644 src/Controls/tests/TestCases/Issues/Issue18526.xaml.cs diff --git a/global.json b/global.json index 2b3c65d222ba..d05a39062b91 100644 --- a/global.json +++ b/global.json @@ -6,5 +6,8 @@ "MSBuild.Sdk.Extras": "3.0.44", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24310.5" + }, + "sdk": { + "allowPrerelease": false } } diff --git a/src/Controls/src/Core/Compatibility/Handlers/Android/FrameRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/Android/FrameRenderer.cs index 6cab4f0a2e94..bb64e53baf5b 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Android/FrameRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Android/FrameRenderer.cs @@ -176,7 +176,7 @@ protected override void OnLayout(bool changed, int l, int t, int r, int b) if (Element.Handler is IPlatformViewHandler pvh && - Element is IContentView cv) + Element is ICrossPlatformLayout cv) { pvh.LayoutVirtualView(l, t, r, b, cv.CrossPlatformArrange); } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18526.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18526.cs new file mode 100644 index 000000000000..f05e62185871 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18526.cs @@ -0,0 +1,26 @@ +using NUnit.Framework; +using NUnit.Framework.Legacy; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue18526 : _IssuesUITest +{ + public override string Issue => "Border not rendering inside a frame"; + + public Issue18526(TestDevice device) + : base(device) + { } + + [Test] + [Category(UITestCategories.Frame)] + public void BorderShouldRender() + { + var label = App.WaitForElement("label"); + var size = label.GetRect(); + Assert.That(label.GetText(), Is.EqualTo(".NET MAUI")); + Assert.That(size.Width, Is.GreaterThan(0)); + Assert.That(size.Height, Is.GreaterThan(0)); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases/Issues/Issue18526.xaml b/src/Controls/tests/TestCases/Issues/Issue18526.xaml new file mode 100644 index 000000000000..06979dc3ffe6 --- /dev/null +++ b/src/Controls/tests/TestCases/Issues/Issue18526.xaml @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases/Issues/Issue18526.xaml.cs b/src/Controls/tests/TestCases/Issues/Issue18526.xaml.cs new file mode 100644 index 000000000000..0b00e6317422 --- /dev/null +++ b/src/Controls/tests/TestCases/Issues/Issue18526.xaml.cs @@ -0,0 +1,14 @@ +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.Xaml; + +namespace Maui.Controls.Sample.Issues; + +[Issue(IssueTracker.Github, 18526, "Border not rendering inside a frame", PlatformAffected.All)] + +public partial class Issue18526 : ContentPage +{ + public Issue18526() + { + InitializeComponent(); + } +} \ No newline at end of file