diff --git a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs index a58ba7d4e6be..0206954ee746 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs @@ -538,7 +538,7 @@ protected virtual void RegisterViewTypes() protected virtual CGRect DetermineEmptyViewFrame() { - nfloat emptyViewHeight = 0; + nfloat emptyViewHeight = CollectionView.Frame.Height; if (_emptyViewFormsElement is IView emptyView) { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/CollectionViewCoreGalleryPage.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/CollectionViewCoreGalleryPage.cs index f32c87f6fc90..f9fc61841a5a 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/CollectionViewCoreGalleryPage.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/CollectionViewCoreGalleryPage.cs @@ -1,4 +1,5 @@ using Controls.Sample.UITests; +using Maui.Controls.Sample.CollectionViewGalleries.EmptyViewGalleries; using Maui.Controls.Sample.CollectionViewGalleries.GroupingGalleries; using Maui.Controls.Sample.CollectionViewGalleries.HeaderFooterGalleries; using Maui.Controls.Sample.CollectionViewGalleries.ItemSizeGalleries; @@ -44,6 +45,7 @@ public CollectionViewCoreGalleryContentPage() // ItemsFromViewModelShouldBeSelected (src\Compatibility\ControlGallery\src\Issues.Shared\CollectionViewBoundMultiSelection.cs) TestBuilder.NavButton("Selection Galleries", () => new SelectionGallery(), Navigation), TestBuilder.NavButton("Item Size Galleries", () => new ItemsSizeGallery(), Navigation), + TestBuilder.NavButton("EmptyView Galleries", () => new EmptyViewGallery(), Navigation) } } }; diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.EmptyView.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.EmptyView.cs new file mode 100644 index 000000000000..1ee076c80577 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.EmptyView.cs @@ -0,0 +1,42 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests +{ +#if IOS + public class CollectionViewEmptyViewTests : CollectionViewUITests + { + protected override bool ResetAfterEachTest => true; + + public CollectionViewEmptyViewTests(TestDevice device) + : base(device) + { + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void EmptyViewItemsSourceNullStringWorks() + { + VisitInitialGallery("EmptyView"); + + VisitSubGallery("EmptyView (null ItemsSource)"); + + // EmptyView string + App.WaitForElement("Nothing to display."); + } + + [Test] + [Category(UITestCategories.CollectionView)] + public void EmptyViewItemsSourceNullViewWorks() + { + VisitInitialGallery("EmptyView"); + + VisitSubGallery("EmptyView (null ItemsSource) View"); + + // EmptyView string + App.WaitForElement("Nothing to display."); + } + } +#endif +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25551.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25551.cs index ea5fbc0f835c..529fb7efb12c 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25551.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25551.cs @@ -8,7 +8,7 @@ using UITest.Appium; using UITest.Core; -namespace Microsoft.Maui.TestCases.Tests.Tests.Issues +namespace Microsoft.Maui.TestCases.Tests.Issues { internal class Issue25551 : _IssuesUITest {