-
Notifications
You must be signed in to change notification settings - Fork 2k
[Android] Fix grouped CollectionView grid row spacing regression #35782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
5beb51c
658f267
cbaaeb2
ee5abda
bfc68ab
afdd6e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| using System.Collections.ObjectModel; | ||
| using Microsoft.Maui.Controls.Shapes; | ||
|
|
||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 35700, | ||
| "Grouped CollectionView items not rendered properly on Android with GridItemsLayout", | ||
| PlatformAffected.Android)] | ||
| public class Issue35700 : TestContentPage | ||
| { | ||
| protected override void Init() | ||
| { | ||
| var collectionView = new CollectionView2 | ||
| { | ||
| AutomationId = "TestCollectionView", | ||
| IsGrouped = true, | ||
| HorizontalOptions = LayoutOptions.Fill, | ||
| Margin = new Thickness(5, 30, 5, 5), | ||
| ItemsLayout = new GridItemsLayout(ItemsLayoutOrientation.Vertical) | ||
| { | ||
| Span = 5, | ||
| VerticalItemSpacing = 30, | ||
| HorizontalItemSpacing = 10, | ||
| }, | ||
| GroupHeaderTemplate = new DataTemplate(() => | ||
| { | ||
| var label = new Label | ||
| { | ||
| HorizontalOptions = LayoutOptions.Fill, | ||
| HorizontalTextAlignment = TextAlignment.Start, | ||
| Padding = new Thickness(10), | ||
| FontSize = 18, | ||
| TextColor = Colors.White, | ||
| FontAttributes = FontAttributes.Bold, | ||
| BackgroundColor = Colors.Gray, | ||
| }; | ||
| label.SetBinding(Label.TextProperty, "Name"); | ||
| return label; | ||
| }), | ||
| ItemTemplate = new DataTemplate(() => | ||
| { | ||
| var label = new Label | ||
| { | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| TextColor = Colors.White, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| HorizontalTextAlignment = TextAlignment.Center, | ||
| }; | ||
| label.SetBinding(Label.TextProperty, "."); | ||
|
|
||
| return new Border | ||
| { | ||
| StrokeShape = new RoundRectangle { CornerRadius = 10 }, | ||
| Padding = new Thickness(5), | ||
| MinimumWidthRequest = 50, | ||
| Stroke = Colors.Transparent, | ||
| BackgroundColor = Colors.Gray, | ||
| StrokeThickness = 1, | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| Content = label, | ||
| }; | ||
| }), | ||
| }; | ||
|
|
||
| collectionView.ItemsSource = new ObservableCollection<NumberGroup35700> | ||
| { | ||
| new NumberGroup35700("100s", new List<string> | ||
| { | ||
| "100", "200", "300", "400", "500", | ||
| "600", "700", "800", "900", | ||
| }), | ||
| new NumberGroup35700("1000s", new List<string> | ||
| { | ||
| "1000", "2000", "3000", "4000", "5000", | ||
| "6000", "7000", "8000", "9000", | ||
| }), | ||
| }; | ||
|
|
||
| Content = collectionView; | ||
| } | ||
| } | ||
|
|
||
| public class NumberGroup35700 : ObservableCollection<string> | ||
| { | ||
| public string Name { get; private set; } | ||
|
|
||
| public NumberGroup35700(string name, List<string> numbers) : base(numbers) | ||
| { | ||
| Name = name; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue35700 : _IssuesUITest | ||
| { | ||
| public Issue35700(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "Grouped CollectionView items not rendered properly on Android with GridItemsLayout"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.CollectionView)] | ||
| public void GroupedCollectionViewGridLayoutRendersCorrectly() | ||
| { | ||
| App.WaitForElement("TestCollectionView"); | ||
| VerifyScreenshot(); | ||
|
Shalini-Ashokan marked this conversation as resolved.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [major] Regression Prevention and Test Coverage - This shared screenshot test runs on all UI test platforms, but the PR only adds an Android snapshot baseline and the issue page is marked Android-only. Non-Android runs can still execute this test and fail at |
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.