diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue31064IndicatorViewSizeUpdatesDynamically.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue31064IndicatorViewSizeUpdatesDynamically.png new file mode 100644 index 000000000000..1c785df6c782 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue31064IndicatorViewSizeUpdatesDynamically.png differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue31064.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue31064.cs new file mode 100644 index 000000000000..40e545498778 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue31064.cs @@ -0,0 +1,54 @@ +namespace Controls.TestCases.HostApp.Issues; + +[Issue(IssueTracker.Github, "31064", "Indicator view size should update dynamically", PlatformAffected.iOS)] + +public class Issue31064 : ContentPage +{ + IndicatorView _indicator; + + public Issue31064() + { + var carousel = new CarouselView + { + ItemsSource = new[] { "Item 1", "Item 2", "Item 3" }, + HeightRequest = 250, + HorizontalScrollBarVisibility = ScrollBarVisibility.Never, + }; + + _indicator = new IndicatorView + { + HorizontalOptions = LayoutOptions.Center + }; + + carousel.IndicatorView = _indicator; + + var button = new Button + { + AutomationId = "Issue31064Button", + Text = "Increase Indicator Size", + HorizontalOptions = LayoutOptions.Center + }; + button.Clicked += (s, e) => + { + _indicator.IndicatorSize = 20; + }; + + Content = new VerticalStackLayout + { + Spacing = 20, + Padding = 20, + Children = + { + new Label + { + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + Text = "Test passes if IndicatorView size updates dynamically" + }, + carousel, + _indicator, + button + } + }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Issue31064IndicatorViewSizeUpdatesDynamically.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Issue31064IndicatorViewSizeUpdatesDynamically.png new file mode 100644 index 000000000000..680bb010b60e Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Issue31064IndicatorViewSizeUpdatesDynamically.png differ diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue31064.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue31064.cs new file mode 100644 index 000000000000..5fe209ecf812 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue31064.cs @@ -0,0 +1,23 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue31064 : _IssuesUITest +{ + public Issue31064(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Indicator view size should update dynamically"; + + [Test] + [Category(UITestCategories.IndicatorView)] + public void Issue31064IndicatorViewSizeUpdatesDynamically() + { + App.WaitForElement("Issue31064Button"); + App.Tap("Issue31064Button"); + VerifyScreenshot(); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Issue31064IndicatorViewSizeUpdatesDynamically.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Issue31064IndicatorViewSizeUpdatesDynamically.png new file mode 100644 index 000000000000..e3bc502634e4 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Issue31064IndicatorViewSizeUpdatesDynamically.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Issue31064IndicatorViewSizeUpdatesDynamically.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Issue31064IndicatorViewSizeUpdatesDynamically.png new file mode 100644 index 000000000000..8ab82e54f8b6 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Issue31064IndicatorViewSizeUpdatesDynamically.png differ diff --git a/src/Core/src/Platform/iOS/UIPageControlExtensions.cs b/src/Core/src/Platform/iOS/UIPageControlExtensions.cs index a89bdf1d92d9..8be24116477c 100644 --- a/src/Core/src/Platform/iOS/UIPageControlExtensions.cs +++ b/src/Core/src/Platform/iOS/UIPageControlExtensions.cs @@ -19,7 +19,7 @@ public static void UpdateIndicatorShape(this MauiPageControl pageControl, IIndic public static void UpdateIndicatorSize(this MauiPageControl pageControl, IIndicatorView indicatorView) { pageControl.IndicatorSize = indicatorView.IndicatorSize; - pageControl.LayoutSubviews(); + pageControl.InvalidateMeasure(); } public static void UpdateHideSingle(this UIPageControl pageControl, IIndicatorView indicatorView)