-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixed CarouselView Loop="False" rendering items incorrectly #25545
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
+34.9 KB
...TestCases.Android.Tests/snapshots/android/CarouselViewShouldRenderCorrectly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 105 additions & 0 deletions
105
src/Controls/tests/TestCases.HostApp/Issues/Issue25192.xaml
This file contains hidden or 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,105 @@ | ||
| <?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.Issue25192"> | ||
| <Grid> | ||
| <CarouselView Margin="2,9,2,20" | ||
| HeightRequest="180" | ||
| Loop="False" | ||
| PeekAreaInsets="20" | ||
| VerticalOptions="End"> | ||
| <CarouselView.ItemsSource> | ||
| <x:Array Type="{x:Type x:String}"> | ||
| <x:String>Item1</x:String> | ||
| <x:String>Item2</x:String> | ||
| <x:String>Item3</x:String> | ||
| </x:Array> | ||
| </CarouselView.ItemsSource> | ||
| <CarouselView.ItemsLayout> | ||
| <LinearItemsLayout ItemSpacing="5" | ||
| Orientation="Horizontal" | ||
| SnapPointsAlignment="Center" | ||
| SnapPointsType="MandatorySingle"/> | ||
| </CarouselView.ItemsLayout> | ||
| <CarouselView.ItemTemplate> | ||
| <DataTemplate | ||
| x:DataType="{x:Null}"> | ||
| <Border BackgroundColor="Red" | ||
| Stroke="Blue" | ||
| StrokeShape="RoundRectangle 12" | ||
| StrokeThickness="0"> | ||
| <Grid Margin="16" | ||
| ColumnDefinitions="*,*" | ||
| ColumnSpacing="15" | ||
| RowDefinitions="*,*,36" | ||
| RowSpacing="15"> | ||
| <VerticalStackLayout | ||
| Grid.Row="0" | ||
| Grid.ColumnSpan="2" | ||
| VerticalOptions="Center"> | ||
| <Label FontSize="16" | ||
| LineBreakMode="WordWrap" | ||
| Text="DummyLabel" | ||
| TextColor="#333333" | ||
| VerticalOptions="Center"/> | ||
| <Label FontFamily="Medium" | ||
| FontSize="14" | ||
| LineBreakMode="WordWrap" | ||
| Text="DummyDesc" | ||
| TextColor="#5F5E6A"/> | ||
| </VerticalStackLayout> | ||
|
|
||
| <Border Grid.Row="1" | ||
| Grid.Column="0" | ||
| BackgroundColor="LightGray" | ||
| HorizontalOptions="Start" | ||
| StrokeShape="RoundRectangle 12" | ||
| StrokeThickness="0" | ||
| VerticalOptions="Center"> | ||
| <Label Grid.Column="1" | ||
| FontFamily="Regular" | ||
| FontSize="14" | ||
| Margin="6" | ||
| AutomationId="{Binding .}" | ||
| Text="{Binding .}" | ||
| TextColor="Black" | ||
| VerticalOptions="Center"/> | ||
| </Border> | ||
|
|
||
| <Border Grid.Row="1" | ||
| Grid.Column="1" | ||
| BackgroundColor="#e8fccf" | ||
| HorizontalOptions="Center" | ||
| StrokeShape="RoundRectangle 12" | ||
| StrokeThickness="0" | ||
| VerticalOptions="Center"> | ||
| <Label Grid.Column="1" | ||
| FontFamily="Regular" | ||
| FontSize="14" | ||
| Margin="6" | ||
| Text="{Binding .}" | ||
| TextColor="#155d27" | ||
| VerticalOptions="Center"/> | ||
| </Border> | ||
|
|
||
| <Label Grid.Row="2" | ||
| FontSize="24" | ||
| HorizontalOptions="Start" | ||
| Text="I am here" | ||
| TextColor="Black" | ||
| VerticalOptions="Center"/> | ||
|
|
||
| <Button Grid.Row="2" | ||
| Grid.Column="1" | ||
| BackgroundColor="White" | ||
| BorderWidth="2" | ||
| TextColor="Black" | ||
| Text="Click me" | ||
| VerticalOptions="Center"/> | ||
| </Grid> | ||
| </Border> | ||
| </DataTemplate> | ||
| </CarouselView.ItemTemplate> | ||
| </CarouselView> | ||
| </Grid> | ||
| </ContentPage> |
11 changes: 11 additions & 0 deletions
11
src/Controls/tests/TestCases.HostApp/Issues/Issue25192.xaml.cs
This file contains hidden or 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,11 @@ | ||
| namespace Maui.Controls.Sample.Issues | ||
| { | ||
| [Issue(IssueTracker.Github, 25192, "CarouselView Loop='False' renders incorrectly items", PlatformAffected.All)] | ||
| public partial class Issue25192 : ContentPage | ||
| { | ||
| public Issue25192() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
| } | ||
| } |
23 changes: 23 additions & 0 deletions
23
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25192.cs
This file contains hidden or 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,23 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue25192 : _IssuesUITest | ||
| { | ||
| public Issue25192(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "CarouselView Loop='False' renders incorrectly items"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.CarouselView)] | ||
| public void CarouselViewShouldRenderCorrectly() | ||
| { | ||
| App.WaitForElement("Item1"); | ||
| VerifyScreenshot(); | ||
kubaflo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| } | ||
Binary file added
BIN
+8.94 KB
...s/TestCases.WinUI.Tests/snapshots/windows/CarouselViewShouldRenderCorrectly.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
+38.9 KB
...s/tests/TestCases.iOS.Tests/snapshots/ios/CarouselViewShouldRenderCorrectly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only removed the
if (Carousel.Loop)condition but indentation changes make it harder to spot