-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PanGesture notify Completed event moving outside View limits (#15700)
* Fix the issue * Added sample * Fix the issue on Android * Updated Impl * Implement the changes also on iOS/Catalyst * Revert changes on Android and iOS * More changes * Remove unnecessary changes * Align Windows behavior with the test of the platforms * Removed unnecessary changes * Added UITest * Removed test * Added UITest
- Loading branch information
1 parent
0ef0c03
commit aafaff3
Showing
9 changed files
with
166 additions
and
10 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/Controls/samples/Controls.Sample.UITests/Issues/Issue5191.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,24 @@ | ||
<?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.Issue5191"> | ||
<Grid | ||
RowDefinitions="*,*"> | ||
<Grid | ||
BackgroundColor="Green"> | ||
<Grid.GestureRecognizers> | ||
<PanGestureRecognizer | ||
PanUpdated="OnPanGestureRecognizerUpdated" /> | ||
</Grid.GestureRecognizers> | ||
<Label | ||
x:Name="InfoLabel" | ||
AutomationId="WaitForStubControl" | ||
TextColor="White"/> | ||
</Grid> | ||
<Grid | ||
Grid.Row="1" | ||
BackgroundColor="Red"> | ||
|
||
</Grid> | ||
</Grid> | ||
</ContentPage> |
21 changes: 21 additions & 0 deletions
21
src/Controls/samples/Controls.Sample.UITests/Issues/Issue5191.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,21 @@ | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Xaml; | ||
using Microsoft.Maui.Platform; | ||
|
||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
[Issue(IssueTracker.Github, 5191, "PanGesture notify Completed event moving outside View limits", PlatformAffected.All)] | ||
public partial class Issue5191 : ContentPage | ||
{ | ||
public Issue5191() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
void OnPanGestureRecognizerUpdated(object sender, PanUpdatedEventArgs e) | ||
{ | ||
InfoLabel.Text = $"StatusType: {e.StatusType}, TotalX: {e.TotalX}, TotalY: {e.TotalY}"; | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...trols/samples/Controls.Sample/Pages/Core/PanGestureGalleries/PanGestureEventsGallery.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,25 @@ | ||
<?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.Pages.PanGestureEventsGallery" | ||
Title="PanGesture Events Gallery"> | ||
<Grid | ||
RowDefinitions="*,*"> | ||
<Grid | ||
BackgroundColor="Green"> | ||
<Grid.GestureRecognizers> | ||
<PanGestureRecognizer | ||
PanUpdated="OnPanGestureRecognizerUpdated" /> | ||
</Grid.GestureRecognizers> | ||
<Label | ||
x:Name="InfoLabel" | ||
TextColor="White"/> | ||
</Grid> | ||
<Grid | ||
Grid.Row="1" | ||
BackgroundColor="Red"> | ||
|
||
</Grid> | ||
</Grid> | ||
</ContentPage> |
17 changes: 17 additions & 0 deletions
17
...ls/samples/Controls.Sample/Pages/Core/PanGestureGalleries/PanGestureEventsGallery.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,17 @@ | ||
using Microsoft.Maui.Controls; | ||
|
||
namespace Maui.Controls.Sample.Pages | ||
{ | ||
public partial class PanGestureEventsGallery : ContentPage | ||
{ | ||
public PanGestureEventsGallery() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
void OnPanGestureRecognizerUpdated(object sender, PanUpdatedEventArgs e) | ||
{ | ||
InfoLabel.Text = $"StatusType: {e.StatusType}, TotalX: {e.TotalX}, TotalY: {e.TotalY}"; | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Controls/samples/Controls.Sample/Pages/Core/PanGestureGalleries/PanGestureGallery.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,33 @@ | ||
using Microsoft.Maui; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Internals; | ||
|
||
namespace Maui.Controls.Sample.Pages | ||
{ | ||
[Preserve(AllMembers = true)] | ||
public class PanGestureGallery : ContentPage | ||
{ | ||
public PanGestureGallery() | ||
{ | ||
var descriptionLabel = | ||
new Label { Text = "PanGesture Galleries", Margin = new Thickness(2, 2, 2, 2) }; | ||
|
||
Title = "PanGesture Galleries"; | ||
|
||
Content = new ScrollView | ||
{ | ||
Content = new StackLayout | ||
{ | ||
Children = | ||
{ | ||
descriptionLabel, | ||
GalleryBuilder.NavButton("PanGesture Playground", () => | ||
new PanGesturePlaygroundGallery(), Navigation), | ||
GalleryBuilder.NavButton("PanGesture Events Gallery", () => | ||
new PanGestureEventsGallery(), Navigation), | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
} |
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
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
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
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,30 @@ | ||
using Microsoft.Maui.AppiumTests; | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Controls.AppiumTests.Tests.Issues | ||
{ | ||
public class Issue5191 : _IssuesUITest | ||
{ | ||
public Issue5191(TestDevice device) : base(device) { } | ||
|
||
public override string Issue => "PanGesture notify Completed event moving outside View limits"; | ||
|
||
[Test] | ||
public void Issue5191Test() | ||
{ | ||
this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.iOS, TestDevice.Mac, TestDevice.Windows }, | ||
"Android Test."); | ||
|
||
App.WaitForElement("WaitForStubControl"); | ||
|
||
// 1. Drag and drop. | ||
App.DragCoordinates(100, 500, 1000, 100); | ||
|
||
// 2. Verify if PanGesture reports a completed event status when the touch is lifted. | ||
var result = App.FindElement("WaitForStubControl").GetText(); | ||
Assert.True(result?.Contains("Completed", StringComparison.OrdinalIgnoreCase)); | ||
} | ||
} | ||
} |