From dc81db844fc5fabb57fdeb4473a32decf760e04f Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Fri, 20 Dec 2024 17:48:55 +0100 Subject: [PATCH 1/2] Flyout Items Not Displayed in RightToLeft FlowDirection on iOS in Landscape - fix --- .../Handlers/FlyoutPage/iOS/PhoneFlyoutPageRenderer.cs | 2 +- .../Tests/Issues/XFIssue/Issue2818.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Controls/src/Core/Compatibility/Handlers/FlyoutPage/iOS/PhoneFlyoutPageRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/FlyoutPage/iOS/PhoneFlyoutPageRenderer.cs index 67816eb67274..db073e4cebcc 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/FlyoutPage/iOS/PhoneFlyoutPageRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/FlyoutPage/iOS/PhoneFlyoutPageRenderer.cs @@ -390,7 +390,7 @@ void LayoutChildren(bool animated) if (IsRTL && !FlyoutOverlapsDetailsInPopoverMode) { - flyoutFrame.X = (int)(flyoutFrame.Width * .25); + flyoutFrame.X = (int)(frame.Width - flyoutFrame.Width); } var detailsFrame = frame; diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2818.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2818.cs index 33a8c2f828c9..e9d6b0639916 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2818.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2818.cs @@ -1,6 +1,5 @@ -#if TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_IOS +#if TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYST // Orientation not supported in Catalyst and Windows -// On iOS FlyoutPage RTL is not working as expected, Issue: https://github.com/dotnet/maui/issues/26726 using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -35,8 +34,8 @@ public void RootViewMovesAndContentIsVisible() Assert.That(positionStart, Is.Not.EqualTo(secondPosition)); } - [Test] - public void RootViewSizeDoesntChangeAfterBackground() + [Test] + public async Task RootViewSizeDoesntChangeAfterBackground() { var idiom = App.WaitForElement("Idiom"); App.SetOrientationLandscape(); @@ -52,6 +51,7 @@ public void RootViewSizeDoesntChangeAfterBackground() App.WaitForNoElement("RootLayout"); App.ForegroundApp(); var newWindowSize = App.WaitForElement("RootLayout"); + await Task.Delay(2000); // Wait for the app to settle after foregrounding Assert.That(newWindowSize.GetRect().Width, Is.EqualTo(windowSize.GetRect().Width)); Assert.That(newWindowSize.GetRect().Height, Is.EqualTo(windowSize.GetRect().Height)); } From bef57ff151c1bf291218419ed5dc9b60043ffd04 Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Sat, 9 Aug 2025 01:09:41 +0200 Subject: [PATCH 2/2] Stabilize window size check in Issue2818 test Replaced fixed delay with a polling loop to wait for the window width to stabilize after foregrounding the app. This change reduces test flakiness on platforms where layout size may temporarily change before settling. --- .../Tests/Issues/XFIssue/Issue2818.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2818.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2818.cs index e9d6b0639916..f75526c505f8 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2818.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2818.cs @@ -1,4 +1,4 @@ -#if TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYST +#if TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_CATALYST // Orientation not supported in Catalyst and Windows using NUnit.Framework; using UITest.Appium; @@ -51,7 +51,17 @@ public async Task RootViewSizeDoesntChangeAfterBackground() App.WaitForNoElement("RootLayout"); App.ForegroundApp(); var newWindowSize = App.WaitForElement("RootLayout"); - await Task.Delay(2000); // Wait for the app to settle after foregrounding + + // Poll until the width stabilizes. After foregrounding, some platforms (esp. Android/iOS) + // may momentarily report an intermediate layout size while the window / flyout re-applies + // RTL + orientation constraints. This loop prevents test flakiness by waiting for the + // final (restored) size instead of asserting too early + int retries = 50; + while (newWindowSize.GetRect().Width != windowSize.GetRect().Width && retries-- > 0) + { + await Task.Delay(100); + } + Assert.That(newWindowSize.GetRect().Width, Is.EqualTo(windowSize.GetRect().Width)); Assert.That(newWindowSize.GetRect().Height, Is.EqualTo(windowSize.GetRect().Height)); }