-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS,MacCatalyst] Fix for SwipeView.Open() throwing an ArgumentException on the second programmatic call #34982
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
+174
−2
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
117 changes: 117 additions & 0 deletions
117
src/Controls/tests/TestCases.HostApp/Issues/Issue34917.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,117 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 34917, "[net 11.0][iOS,MacCatalyst] SwipeView.Open() throws ArgumentException on second programmatic call", PlatformAffected.iOS | PlatformAffected.macOS)] | ||
| public class Issue34917 : ContentPage | ||
| { | ||
| const string OpenRightButtonId = "OpenSwipeButton"; | ||
| const string OpenBottomButtonId = "OpenBottomSwipeButton"; | ||
| const string CloseButtonId = "CloseSwipeButton"; | ||
| const string StatusLabelId = "StatusLabel"; | ||
|
|
||
| readonly SwipeView _swipeView; | ||
|
|
||
| public Issue34917() | ||
| { | ||
| var openRightButton = new Button | ||
| { | ||
| Text = "Open RightItems", | ||
| AutomationId = OpenRightButtonId | ||
| }; | ||
|
|
||
| var openBottomButton = new Button | ||
| { | ||
| Text = "Open BottomItems", | ||
| AutomationId = OpenBottomButtonId | ||
| }; | ||
|
|
||
| var closeButton = new Button | ||
| { | ||
| Text = "Close SwipeView", | ||
| AutomationId = CloseButtonId | ||
| }; | ||
|
|
||
| var statusLabel = new Label | ||
| { | ||
| Text = "Ready", | ||
| AutomationId = StatusLabelId, | ||
| HorizontalOptions = LayoutOptions.Center | ||
| }; | ||
|
|
||
| var rightSwipeItem = new SwipeItem | ||
| { | ||
| Text = "Right Action", | ||
| BackgroundColor = Colors.LightBlue | ||
| }; | ||
|
|
||
| var bottomSwipeItem = new SwipeItem | ||
| { | ||
| Text = "Bottom Action", | ||
| BackgroundColor = Colors.LightGreen | ||
| }; | ||
|
|
||
| _swipeView = new SwipeView | ||
| { | ||
| HeightRequest = 60, | ||
| RightItems = new SwipeItems { rightSwipeItem }, | ||
| BottomItems = new SwipeItems { bottomSwipeItem }, | ||
| Content = new Grid | ||
| { | ||
| BackgroundColor = Colors.LightGray, | ||
| Children = | ||
| { | ||
| new Label | ||
| { | ||
| Text = "Swipe content", | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| VerticalOptions = LayoutOptions.Center | ||
| } | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| openRightButton.Clicked += (s, e) => | ||
| { | ||
| try | ||
| { | ||
| _swipeView.Open(OpenSwipeItem.RightItems); | ||
| statusLabel.Text = "Success"; | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| statusLabel.Text = $"Error: {ex.GetType().Name}"; | ||
| } | ||
| }; | ||
|
|
||
| openBottomButton.Clicked += (s, e) => | ||
| { | ||
| try | ||
| { | ||
| _swipeView.Open(OpenSwipeItem.BottomItems); | ||
| statusLabel.Text = "Success"; | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| statusLabel.Text = $"Error: {ex.GetType().Name}"; | ||
| } | ||
| }; | ||
|
|
||
| closeButton.Clicked += (s, e) => | ||
| { | ||
| _swipeView.Close(); | ||
| }; | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Spacing = 12, | ||
| Padding = new Thickness(20), | ||
| Children = | ||
| { | ||
| openRightButton, | ||
| openBottomButton, | ||
| closeButton, | ||
| _swipeView, | ||
| statusLabel | ||
| } | ||
| }; | ||
| } | ||
| } |
56 changes: 56 additions & 0 deletions
56
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34917.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,56 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue34917 : _IssuesUITest | ||
| { | ||
| public Issue34917(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "[net 11.0][iOS,MacCatalyst] SwipeView.Open() throws ArgumentException on second programmatic call"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.SwipeView)] | ||
| public void SwipeViewOpenRightDoesNotThrowOnSecondCall() | ||
| { | ||
| App.WaitForElement(OpenRightButtonId); | ||
|
|
||
| App.Tap(OpenRightButtonId); | ||
| App.WaitForElement(StatusLabelId); | ||
| App.WaitForTextToBePresentInElement(StatusLabelId, "Success"); | ||
| Assert.That(App.FindElement(StatusLabelId).GetText(), Is.EqualTo("Success"), | ||
| "First Open(RightItems) call should succeed."); | ||
|
|
||
| App.Tap(OpenRightButtonId); | ||
| App.WaitForTextToBePresentInElement(StatusLabelId, "Success"); | ||
| Assert.That(App.FindElement(StatusLabelId).GetText(), Is.EqualTo("Success"), | ||
| "Second consecutive Open(RightItems) call should not throw an exception."); | ||
| } | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.SwipeView)] | ||
| public void SwipeViewOpenBottomDoesNotThrowOnSecondCall() | ||
| { | ||
| App.WaitForElement(OpenBottomButtonId); | ||
| App.WaitForElement(CloseButtonId); | ||
|
|
||
| App.Tap(CloseButtonId); | ||
|
|
||
| App.Tap(OpenBottomButtonId); | ||
| App.WaitForElement(StatusLabelId); | ||
| App.WaitForTextToBePresentInElement(StatusLabelId, "Success"); | ||
| Assert.That(App.FindElement(StatusLabelId).GetText(), Is.EqualTo("Success"), | ||
| "First Open(BottomItems) call should succeed."); | ||
|
|
||
| App.Tap(OpenBottomButtonId); | ||
| App.WaitForTextToBePresentInElement(StatusLabelId, "Success"); | ||
| Assert.That(App.FindElement(StatusLabelId).GetText(), Is.EqualTo("Success"), | ||
| "Second consecutive Open(BottomItems) call should not throw an exception."); | ||
|
BagavathiPerumal marked this conversation as resolved.
|
||
| } | ||
|
|
||
| const string OpenRightButtonId = "OpenSwipeButton"; | ||
| const string OpenBottomButtonId = "OpenBottomSwipeButton"; | ||
| const string CloseButtonId = "CloseSwipeButton"; | ||
| const string StatusLabelId = "StatusLabel"; | ||
| } | ||
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
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.