diff --git a/src/Controls/tests/DeviceTests/Elements/ScrollView/ScrollViewTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/ScrollView/ScrollViewTests.Android.cs deleted file mode 100644 index ef53a8ef0c8a..000000000000 --- a/src/Controls/tests/DeviceTests/Elements/ScrollView/ScrollViewTests.Android.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.Maui.Controls; -using Microsoft.Maui.Graphics; -using Microsoft.Maui.Platform; -using Xunit; -using static Microsoft.Maui.DeviceTests.AssertHelpers; -using ABitmap = Android.Graphics.Bitmap; -using ACanvas = Android.Graphics.Canvas; - -namespace Microsoft.Maui.DeviceTests -{ - public partial class ScrollViewTests - { - // https://github.com/dotnet/maui/issues/37306 - [Fact(DisplayName = "ScrollView content draws under the safe-area padding while scrolled")] - public async Task ContentDrawsUnderSafeAreaPaddingWhileScrolled() - { - SetupBuilder(); - - var scrollView = new ScrollView - { - BackgroundColor = Colors.Blue, - Content = new VerticalStackLayout { BackgroundColor = Colors.Red, HeightRequest = 5000 } - }; - var page = new ContentPage { SafeAreaEdges = SafeAreaEdges.None, Content = scrollView }; - - await CreateHandlerAndAddToWindow(page, async () => - { - var platformView = (MauiScrollView)scrollView.Handler.PlatformView; - await AssertEventually(() => platformView.PaddingTop > 0 || platformView.PaddingBottom > 0, - timeout: 5000, message: "The ScrollView never received safe-area padding."); - - await scrollView.ScrollToAsync(0, 1000, false); - Assert.True(platformView.ScrollY > 0, "The ScrollView did not scroll."); - - using var bitmap = ABitmap.CreateBitmap(platformView.Width, platformView.Height, ABitmap.Config.Argb8888); - using (var canvas = new ACanvas(bitmap)) - { - // A parent applies the scroll offset when it draws the ScrollView, so do the same here. - canvas.Translate(-platformView.ScrollX, -platformView.ScrollY); - platformView.Draw(canvas); - } - - // Mid-scroll, the padding bands must show the same content as the middle of the viewport, - // not the ScrollView's background. - var x = bitmap.Width / 2; - var content = bitmap.ColorAtPoint(x, bitmap.Height / 2); - if (platformView.PaddingTop > 0) - bitmap.AssertColorAtPoint(content, x, platformView.PaddingTop / 2); - if (platformView.PaddingBottom > 0) - bitmap.AssertColorAtPoint(content, x, bitmap.Height - 1 - platformView.PaddingBottom / 2); - - Assert.False(platformView.ClipToPadding); - }); - } - } -} diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Issue35410_Landscape.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Issue35410_Landscape.png index 241c22a4d1fc..52150649b975 100644 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Issue35410_Landscape.png and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/Issue35410_Landscape.png differ diff --git a/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Android.cs b/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Android.cs index 6ab68ade6d7f..e8be6474f7ab 100644 --- a/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Android.cs +++ b/src/Core/src/Handlers/ScrollView/ScrollViewHandler.Android.cs @@ -18,9 +18,6 @@ protected override MauiScrollView CreatePlatformView() FillViewport = true }; - // Safe-area insets arrive as native padding; let the content scroll under them, as on iOS. - scrollView.SetClipToPadding(false); - return scrollView; }