diff --git a/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.cs b/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.cs index 927ebaf78c32..c014fb0950a7 100644 --- a/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.cs @@ -92,34 +92,7 @@ await RunShellTest(shell => Assert.Contains(shellSectionGrid, (shellSection as IVisualTreeElement).GetVisualChildren()); Assert.Contains(shellContentGrid, (shellContent as IVisualTreeElement).GetVisualChildren()); }); - } - - [Fact] - public async Task FlyoutHeaderAdaptsToMinimumHeight() - { - await RunShellTest(shell => - { - var layout = new VerticalStackLayout() - { - new Label() { Text = "Flyout Header" } - }; - - layout.MinimumHeightRequest = 30; - - shell.FlyoutHeader = layout; - shell.FlyoutHeaderBehavior = FlyoutHeaderBehavior.CollapseOnScroll; - }, - async (shell, handler) => - { - await OpenFlyout(handler); - var flyoutFrame = GetFrameRelativeToFlyout(handler, shell.FlyoutHeader as IView); - - await AssertionExtensions.AssertEventually(() => - { - return Math.Abs(30 - flyoutFrame.Height) < 0.2; - }, message: $"Expected: {30}. Actual: {flyoutFrame.Height}. Diff: {Math.Abs(30 - flyoutFrame.Height)}"); - }); - } + } #if !WINDOWS [Theory] diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue24284.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue24284.xaml new file mode 100644 index 000000000000..8644c2666f51 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue24284.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue24284.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue24284.xaml.cs new file mode 100644 index 000000000000..79be566680d7 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue24284.xaml.cs @@ -0,0 +1,22 @@ +namespace Maui.Controls.Sample.Issues; + +[XamlCompilation(XamlCompilationOptions.Compile)] +[Issue(IssueTracker.Github, 24284, "FlyoutHeaderAdaptsToMinimumHeight", PlatformAffected.All)] +public partial class Issue24284 : Shell +{ + public Issue24284() + { + InitializeComponent(); + + var label = new Label() + { + AutomationId = "HeaderLabel", + Text = "Flyout Header", + MinimumHeightRequest = 30, + }; + + FlyoutHeader = label; + FlyoutHeaderBehavior = FlyoutHeaderBehavior.CollapseOnScroll; + FlyoutIsPresented = true; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue24284.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue24284.cs new file mode 100644 index 000000000000..302b4ef6cd3e --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue24284.cs @@ -0,0 +1,24 @@ +using NUnit.Framework; +using NUnit.Framework.Legacy; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues +{ + public class Issue24284 : _IssuesUITest + { + public Issue24284(TestDevice testDevice) : base(testDevice){ } + + public override string Issue => "FlyoutHeaderAdaptsToMinimumHeight"; + + [Test] + [Category(UITestCategories.Shell)] + public void FlyoutHeaderAdaptsToMinimumHeight() + { + var heightReferenceLabel = App.WaitForElement("HeightReferenceLabel").GetRect(); + var headerLabel = App.WaitForElement("HeaderLabel").GetRect(); + + ClassicAssert.True(Math.Abs(headerLabel.Height - heightReferenceLabel.Height) < 0.2); + } + } +} \ No newline at end of file