-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Windows] Fix Indicator View Causing Looping Issue with CarouselView #27880
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
Open
Tamilarasan-Paranthaman
wants to merge
8
commits into
dotnet:main
Choose a base branch
from
Tamilarasan-Paranthaman:fix-27563
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d3aa4de
Carousel scrolling issue fix
Tamilarasan-Paranthaman 94e4f9d
Added test sample.
Tamilarasan-Paranthaman e181d3a
Added snapshots
Tamilarasan-Paranthaman 058fda3
Test sample changes
Tamilarasan-Paranthaman c55024a
Updated test script
Tamilarasan-Paranthaman 3be4861
Update CarouselViewHandler.Windows.cs
Vignesh-SF3580 ce189d0
Update CarouselViewHandler.Windows.cs
Vignesh-SF3580 f26b850
tests updated.
Vignesh-SF3580 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
+57.5 KB
...tests/TestCases.Android.Tests/snapshots/android/VerifyCarouselViewScrolling.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
149 changes: 149 additions & 0 deletions
149
src/Controls/tests/TestCases.HostApp/Issues/Issue27563.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,149 @@ | ||
| using System.Collections.ObjectModel; | ||
|
|
||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 27563, "[Windows] CarouselView Scrolling Issue", PlatformAffected.UWP)] | ||
| public partial class Issue27563 : ContentPage | ||
| { | ||
| public Issue27563() | ||
| { | ||
| var verticalStackLayout = new VerticalStackLayout(); | ||
|
|
||
| var carouselItems = new ObservableCollection<string> | ||
| { | ||
| "Remain View", | ||
| "Actual View", | ||
| "Percentage View", | ||
| }; | ||
|
|
||
| CarouselView carousel = new CarouselView | ||
| { | ||
| ItemsSource = carouselItems, | ||
| AutomationId = "carouselview", | ||
| HeightRequest = 200, | ||
| ItemTemplate = new DataTemplate(() => | ||
| { | ||
| var grid = new Grid | ||
| { | ||
| Padding = 10 | ||
| }; | ||
|
|
||
| var label = new Label | ||
| { | ||
| VerticalOptions = LayoutOptions.Center, | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| FontSize = 18, | ||
| }; | ||
| label.SetBinding(Label.TextProperty, "."); | ||
| label.SetBinding(Label.AutomationIdProperty, "."); | ||
|
|
||
| grid.Children.Add(label); | ||
| return grid; | ||
| }), | ||
| HorizontalOptions = LayoutOptions.Fill, | ||
| }; | ||
|
|
||
| var indicatorView = new IndicatorView | ||
| { | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| VerticalOptions = LayoutOptions.Center | ||
| }; | ||
|
|
||
| carousel.IndicatorView = indicatorView; | ||
|
|
||
| var carouselPositionLabel = new Label | ||
| { | ||
| Text = "CarouselPos:0", | ||
| AutomationId = "carouselPositionLabel", | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| }; | ||
|
|
||
| var indicatorPositionLabel = new Label | ||
| { | ||
| Text = "IndicatorPos:0", | ||
| AutomationId = "indicatorPositionLabel", | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| }; | ||
|
|
||
| var pingLabel = new Label | ||
| { | ||
| Text = "Ping:0", | ||
| AutomationId = "pingLabel", | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| }; | ||
|
|
||
| var currentItemLabel = new Label | ||
| { | ||
| Text = "CurrentItem:Remain View", | ||
| AutomationId = "currentItemLabel", | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| }; | ||
|
|
||
| var scrollToSecondButton = new Button | ||
| { | ||
| Text = "Scroll To Second Item", | ||
| AutomationId = "ScrollToSecondButton", | ||
| Margin = new Thickness(20, 10), | ||
| }; | ||
|
|
||
| scrollToSecondButton.Clicked += (sender, e) => | ||
| { | ||
| carousel.ScrollTo(1, position: ScrollToPosition.Center, animate: false); | ||
| }; | ||
|
|
||
| var positionButton = new Button | ||
| { | ||
| Text = "Change IndicatorView Position", | ||
| AutomationId = "PositionButton", | ||
| Margin = new Thickness(20, 10), | ||
| }; | ||
|
|
||
| positionButton.Clicked += (sender, e) => | ||
| { | ||
| indicatorView.Position = 2; | ||
| }; | ||
|
|
||
| var pingCount = 0; | ||
| var pingButton = new Button | ||
| { | ||
| Text = "Ping", | ||
| AutomationId = "PingButton", | ||
| Margin = new Thickness(20, 10), | ||
| }; | ||
|
|
||
| pingButton.Clicked += (sender, e) => | ||
| { | ||
| pingCount++; | ||
| pingLabel.Text = $"Ping:{pingCount}"; | ||
| }; | ||
|
|
||
| carousel.PropertyChanged += (sender, e) => | ||
| { | ||
| if (e.PropertyName == CarouselView.PositionProperty.PropertyName) | ||
| carouselPositionLabel.Text = $"CarouselPos:{carousel.Position}"; | ||
| }; | ||
|
|
||
| indicatorView.PropertyChanged += (sender, e) => | ||
| { | ||
| if (e.PropertyName == IndicatorView.PositionProperty.PropertyName) | ||
| indicatorPositionLabel.Text = $"IndicatorPos:{indicatorView.Position}"; | ||
| }; | ||
|
|
||
| carousel.CurrentItemChanged += (sender, e) => | ||
| { | ||
| currentItemLabel.Text = $"CurrentItem:{carousel.CurrentItem}"; | ||
| }; | ||
|
|
||
| verticalStackLayout.Children.Add(carousel); | ||
| verticalStackLayout.Children.Add(indicatorView); | ||
| verticalStackLayout.Children.Add(scrollToSecondButton); | ||
| verticalStackLayout.Children.Add(positionButton); | ||
| verticalStackLayout.Children.Add(pingButton); | ||
| verticalStackLayout.Children.Add(carouselPositionLabel); | ||
| verticalStackLayout.Children.Add(indicatorPositionLabel); | ||
| verticalStackLayout.Children.Add(currentItemLabel); | ||
| verticalStackLayout.Children.Add(pingLabel); | ||
|
|
||
| Content = verticalStackLayout; | ||
| } | ||
| } |
50 changes: 50 additions & 0 deletions
50
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27563.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,50 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue27563 : _IssuesUITest | ||
| { | ||
| public override string Issue => "[Windows] CarouselView Scrolling Issue"; | ||
|
|
||
| public Issue27563(TestDevice device) | ||
| : base(device) | ||
| { } | ||
|
|
||
| #if !WINDOWS // On Windows, TimeoutException is thrown when enabling the Loop. Refer issue: https://github.com/dotnet/maui/issues/29245 | ||
| [Test, Order(1)] | ||
| [Category(UITestCategories.CarouselView)] | ||
| public void VerifyCarouselViewIndicatorPositionWithoutLooping() | ||
| { | ||
| App.WaitForElement("carouselview"); | ||
| App.WaitForElement("Remain View"); | ||
|
|
||
| App.Tap("ScrollToSecondButton"); | ||
| App.WaitForElement("Actual View"); | ||
|
|
||
| App.Tap("PositionButton"); | ||
jsuarezruiz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| App.WaitForElement("Percentage View"); | ||
|
|
||
| App.Tap("PingButton"); | ||
| App.WaitForElement("Ping:1"); | ||
| App.Tap("ScrollToSecondButton"); | ||
| } | ||
| #endif | ||
|
|
||
| #if !WINDOWS && !MACCATALYST | ||
| // On Catalyst, Swipe actions not supported in Appium. | ||
| // On Windows, TimeoutException is thrown when enabling the Loop. Refer issue: https://github.com/dotnet/maui/issues/29245 | ||
| [Test, Order(2)] | ||
| [Category(UITestCategories.CarouselView)] | ||
| public void VerifyCarouselViewScrolling() | ||
| { | ||
| App.WaitForElement("carouselview"); | ||
| App.SwipeRightToLeft("carouselview"); | ||
| App.WaitForElement("Percentage View"); | ||
| App.Tap("PositionButton"); | ||
| VerifyScreenshot(); | ||
| } | ||
| #endif | ||
| } | ||
| } | ||
Binary file added
BIN
+66.3 KB
...ontrols/tests/TestCases.iOS.Tests/snapshots/ios/VerifyCarouselViewScrolling.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.