diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue33241Test.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue33241Test.png new file mode 100644 index 000000000000..9e84f3661f6f Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue33241Test.png differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue33241.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue33241.cs new file mode 100644 index 000000000000..c8b609a50d15 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue33241.cs @@ -0,0 +1,33 @@ +using Microsoft.Maui.Controls.Shapes; +namespace Maui.Controls.Sample.Issues; + +[Issue(IssueTracker.Github, 33241, "StackLayout fails to render content while applying Clip, and the layout is placed inside a Border with Background", PlatformAffected.iOS | PlatformAffected.macOS)] +public class Issue33241 : ContentPage +{ + public Issue33241() + { + var layout = + new Border + { + Background = Colors.SkyBlue, + Padding = 10, + Content = + new Issue33241_CustomView + { + Background = Colors.Red, + AutomationId = "CustomView", + Padding = 10 + } + }; + Content = layout; + } +} + +public class Issue33241_CustomView : StackLayout +{ + protected override void OnSizeAllocated(double width, double height) + { + this.Clip = new RoundRectangleGeometry { Rect = new Rect(0, 0, width, height) }; + base.OnSizeAllocated(width, height); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Issue33241Test.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Issue33241Test.png new file mode 100644 index 000000000000..f12088536e94 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Issue33241Test.png differ diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33241.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33241.cs new file mode 100644 index 000000000000..6c3400cbe016 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33241.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue33241 : _IssuesUITest +{ + public Issue33241(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "StackLayout fails to render content while applying Clip, and the layout is placed inside a Border with Background"; + + [Test] + [Category(UITestCategories.Border)] + public void Issue33241Test() + { + App.WaitForElement("CustomView"); + VerifyScreenshot(); + } +} diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Issue33241Test.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Issue33241Test.png new file mode 100644 index 000000000000..7007e1d269d7 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Issue33241Test.png differ diff --git a/src/Core/src/Platform/iOS/WrapperView.cs b/src/Core/src/Platform/iOS/WrapperView.cs index b75189a2f877..db298fe6c14a 100644 --- a/src/Core/src/Platform/iOS/WrapperView.cs +++ b/src/Core/src/Platform/iOS/WrapperView.cs @@ -99,10 +99,15 @@ public override void LayoutSubviews() return; if (_borderView is not null) + { BringSubviewToFront(_borderView); + } + else + { + this.Superview?.BringSubviewToFront(this); + } var child = subviews[0]; - child.Frame = Bounds; if (MaskLayer is not null)