diff --git a/src/Core/src/Platform/iOS/ViewExtensions.cs b/src/Core/src/Platform/iOS/ViewExtensions.cs index b79257076f14..df30aa16b40b 100644 --- a/src/Core/src/Platform/iOS/ViewExtensions.cs +++ b/src/Core/src/Platform/iOS/ViewExtensions.cs @@ -268,23 +268,16 @@ public static void UpdateBackgroundLayerFrame(this UIView view) var layer = view.Layer; - UpdateBackgroundLayerFrame(layer, view.Bounds); - } - - static void UpdateBackgroundLayerFrame(CALayer layer, CGRect bounds) - { if (layer == null || layer.Sublayers == null || layer.Sublayers.Length == 0) return; foreach (var sublayer in layer.Sublayers) { - if (sublayer.Name == BackgroundLayerName && sublayer.Frame != bounds) + if (sublayer.Name == BackgroundLayerName && sublayer.Frame != view.Bounds) { - sublayer.Frame = bounds; + sublayer.Frame = view.Bounds; break; } - - UpdateBackgroundLayerFrame(sublayer, bounds); } } diff --git a/src/Core/tests/DeviceTests/Handlers/ContentView/ContentViewTests.iOS.cs b/src/Core/tests/DeviceTests/Handlers/ContentView/ContentViewTests.iOS.cs index 70fb6de52381..956cc11f764b 100644 --- a/src/Core/tests/DeviceTests/Handlers/ContentView/ContentViewTests.iOS.cs +++ b/src/Core/tests/DeviceTests/Handlers/ContentView/ContentViewTests.iOS.cs @@ -1,5 +1,4 @@ -using System; -using System.Threading.Tasks; +using System.Threading.Tasks; using Microsoft.Maui.DeviceTests.Stubs; using UIKit; using Xunit; @@ -9,23 +8,6 @@ namespace Microsoft.Maui.DeviceTests.Handlers.ContentView [Category(TestCategory.ContentView)] public partial class ContentViewTests { - [Theory(DisplayName = "Background Updates Correctly")] - [InlineData(0xFF0000)] - [InlineData(0x00FF00)] - [InlineData(0x0000FF)] - public async Task BackgroundUpdatesCorrectly(uint color) - { - var expected = Color.FromUint(color); - - var contentView = new ContentViewStub() - { - Content = new LabelStub { Text = "Background", TextColor = Colors.White }, - Background = new LinearGradientPaintStub(Colors.Red, Colors.Blue), - }; - - await ValidateHasColor(contentView, expected); - } - [Fact, Category(TestCategory.FlowDirection)] public async Task FlowDirectionPropagatesToContent() { @@ -123,18 +105,5 @@ public async Task DoesNotPropagateToContentWithExplicitFlowDirection() Assert.Equal(UIUserInterfaceLayoutDirection.LeftToRight, labelFlowDirection); } - - Platform.ContentView GetNativeContentView(ContentViewHandler contentViewHandler) => - contentViewHandler.PlatformView; - - Task ValidateHasColor(IContentView contentView, Color color, Action action = null) - { - return InvokeOnMainThreadAsync(() => - { - var nativeContentView = GetNativeContentView(CreateHandler(contentView)); - action?.Invoke(); - nativeContentView.AssertContainsColor(color); - }); - } } }