forked from dotnet/maui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Fixed CollectionView MeasureFirstItem Rendering issue (dotn…
…et#25367) * Fixed-25191 : CollectionView ItemSizingStrategy:MeasureFirstItem renders labels incorrectly. * added windows snapshot.
- Loading branch information
1 parent
ea0e7bb
commit c21b518
Showing
7 changed files
with
133 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+75.7 KB
...ts/TestCases.Android.Tests/snapshots/android/CollectionViewMeasureFirstItem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 81 additions & 0 deletions
81
src/Controls/tests/TestCases.HostApp/Issues/Issue25191.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Issues.Issue25191"> | ||
|
||
<Grid RowDefinitions="50,*" x:Name="grid"> | ||
|
||
<CollectionView Grid.Row="2" x:Name="collectionView" | ||
ItemSizingStrategy="MeasureFirstItem" | ||
ItemsSource="{Binding Items}" | ||
AutomationId="collectionView"> | ||
<CollectionView.EmptyView> | ||
<Label HorizontalOptions="Center" | ||
Text="Test Label" | ||
VerticalOptions="Center" /> | ||
</CollectionView.EmptyView> | ||
<CollectionView.ItemTemplate> | ||
<DataTemplate x:DataType="{x:Null}"> | ||
<Border Margin="0,5" | ||
BackgroundColor="White" | ||
HeightRequest="140" | ||
StrokeShape="RoundRectangle 8" | ||
StrokeThickness="0"> | ||
<Grid Margin="10,8" | ||
ColumnDefinitions="80,*,0.5*,*" | ||
ColumnSpacing="0" | ||
RowDefinitions="18,8,*,*,*" | ||
RowSpacing="0"> | ||
|
||
<Label Margin="5,0,0,0" | ||
FontSize="10" | ||
Text="Header Label" | ||
TextColor="DimGray" /> | ||
|
||
<Label Grid.Row="0" | ||
Grid.Column="3" | ||
FontSize="10" | ||
HorizontalOptions="End" | ||
LineBreakMode="WordWrap" | ||
Text="Top Right Text Here" | ||
TextColor="DimGray" /> | ||
|
||
<Border Grid.Row="2" | ||
Grid.RowSpan="3" | ||
BackgroundColor="Red" | ||
StrokeShape="RoundRectangle 10" /> | ||
|
||
<Button Grid.Row="2" | ||
Grid.Column="1" | ||
Grid.ColumnSpan="3" | ||
Margin="8,0,0,0" | ||
FontSize="14" | ||
Text="Test Button" | ||
VerticalOptions="Center" /> | ||
|
||
<Label Grid.Row="3" | ||
Grid.Column="1" | ||
Grid.ColumnSpan="3" | ||
Margin="8,0,0,0" | ||
FontSize="10" | ||
Text="Middle Text Here" | ||
TextColor="Gray" | ||
VerticalOptions="Center" /> | ||
|
||
<Label Grid.Row="4" x:Name="label" | ||
Grid.Column="3" | ||
FontSize="12" | ||
HorizontalOptions="End" | ||
LineBreakMode="NoWrap" | ||
Text="Footer Label" | ||
TextColor="Black" | ||
VerticalOptions="Center" /> | ||
</Grid> | ||
</Border> | ||
</DataTemplate> | ||
</CollectionView.ItemTemplate> | ||
</CollectionView> | ||
|
||
</Grid> | ||
|
||
</ContentPage> |
25 changes: 25 additions & 0 deletions
25
src/Controls/tests/TestCases.HostApp/Issues/Issue25191.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Collections.ObjectModel; | ||
|
||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[Issue(IssueTracker.Github, 25191, "CollectionView ItemSizingStrategy:MeasureFirstItem renders labels incorrectly", PlatformAffected.Android)] | ||
public partial class Issue25191 : ContentPage | ||
{ | ||
public Issue25191() | ||
{ | ||
InitializeComponent(); | ||
BindingContext = new MainViewModel(); | ||
} | ||
} | ||
|
||
public class MainViewModel | ||
{ | ||
public ObservableCollection<string> Items { get; set; } = new ObservableCollection<string> | ||
{ | ||
"Item 1", | ||
"Item 2", | ||
"Item 3", | ||
"Item 4" | ||
}; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25191.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#if !MACCATALYST | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues | ||
{ | ||
public class Issue25191 : _IssuesUITest | ||
{ | ||
public Issue25191(TestDevice device) : base(device) | ||
{ | ||
} | ||
|
||
public override string Issue => "CollectionView ItemSizingStrategy:MeasureFirstItem renders labels incorrectly"; | ||
|
||
[Test] | ||
[Category(UITestCategories.CollectionView)] | ||
public void CollectionViewMeasureFirstItem() | ||
{ | ||
App.WaitForElement("collectionView"); | ||
VerifyScreenshot(); | ||
} | ||
} | ||
} | ||
#endif |
Binary file added
BIN
+20.6 KB
...ests/TestCases.WinUI.Tests/snapshots/windows/CollectionViewMeasureFirstItem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+90.7 KB
...rols/tests/TestCases.iOS.Tests/snapshots/ios/CollectionViewMeasureFirstItem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.