From 70c108d3010f59634366e56fdcfcc4c4b3963df5 Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Tue, 17 Dec 2024 12:17:56 +0000 Subject: [PATCH 1/4] [sample] Enable EmptyView gallery --- .../Elements/CollectionView/CollectionViewCoreGalleryPage.cs | 2 ++ 1 file changed, 2 insertions(+) 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) } } }; From 6ec892c1d7cb0dc597ea591f873802e95e29c29f Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Tue, 17 Dec 2024 12:32:41 +0000 Subject: [PATCH 2/4] [tests] Fix namespace --- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue25551.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { From da109fb622b82e62100115155d1a878bf985bbcb Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Tue, 17 Dec 2024 12:33:03 +0000 Subject: [PATCH 3/4] [tests] Add CollectionViewEmptyViewTests --- .../CollectionViewUITests.EmptyView.cs | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.EmptyView.cs 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 From e6dcc84f0327b350ae755a27f392014560bb2f61 Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Tue, 17 Dec 2024 14:08:49 +0000 Subject: [PATCH 4/4] [iOS] Set default emptyviewHeight to be the CV Frame.Height --- src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) {