summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-10-04 09:43:44 -0700
committerJason Smith <jason.smith@xamarin.com>2016-10-04 09:43:44 -0700
commitc83c19f106162ca55ab57dfea3693246ec6155fa (patch)
tree5ccb4da39788c578524ac072c6d3fda757b4e088 /Xamarin.Forms.Controls.Issues
parent47b61aab59e52832ff65d0a1aaeafb9dceeaca64 (diff)
downloadxamarin-forms-c83c19f106162ca55ab57dfea3693246ec6155fa.tar.gz
xamarin-forms-c83c19f106162ca55ab57dfea3693246ec6155fa.tar.bz2
xamarin-forms-c83c19f106162ca55ab57dfea3693246ec6155fa.zip
[A] PanGestureRecognizer will consistently send Started/Move event (#389)
* Add reproduction for Bugzilla 39768 * [A] Handle onTouchEvent MOVE
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39768.cs87
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
2 files changed, 88 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39768.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39768.cs
new file mode 100644
index 00000000..ae365782
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39768.cs
@@ -0,0 +1,87 @@
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using System;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 39768, "PanGestureRecognizer sometimes won't fire completed event when dragging very slowly")]
+ public class Bugzilla39768 : TestContentPage
+ {
+ Image _Image;
+ Label _Label;
+ const string ImageName = "image";
+
+ [Preserve(AllMembers = true)]
+ public class PanContainer : ContentView
+ {
+ double x, y;
+
+ public EventHandler<PanUpdatedEventArgs> Panning;
+ public EventHandler<PanUpdatedEventArgs> PanningCompleted;
+
+ public PanContainer()
+ {
+ var panGesture = new PanGestureRecognizer();
+ panGesture.PanUpdated += OnPanUpdated;
+ GestureRecognizers.Add(panGesture);
+ }
+
+ void OnPanUpdated(object sender, PanUpdatedEventArgs e)
+ {
+ switch (e.StatusType)
+ {
+ case GestureStatus.Started:
+ break;
+
+ case GestureStatus.Running:
+ Content.TranslationX = x + e.TotalX;
+ Content.TranslationY = y + e.TotalY;
+
+ Panning?.Invoke(sender, e);
+ break;
+
+ case GestureStatus.Completed:
+ x = Content.TranslationX;
+ y = Content.TranslationY;
+
+ PanningCompleted?.Invoke(sender, e);
+ break;
+ }
+ }
+ }
+
+ protected override void Init()
+ {
+ _Image = new Image { Source = ImageSource.FromFile("crimson.jpg"), WidthRequest = 350, HeightRequest = 350, AutomationId = ImageName };
+ _Label = new Label { Text = "Press and hold the image for 1 second without moving it, then attempt to drag the image. If the image does not move, this test has failed. If this label does not display 'Success' when you have finished the pan, this test has failed." };
+
+ var panView = new PanContainer()
+ {
+ Content = _Image,
+ Panning = (s, e) =>
+ {
+ _Label.Text = $"TotalX: {e.TotalX}, TotalY: {e.TotalY}";
+ },
+ PanningCompleted = (s, e) =>
+ {
+ _Label.Text = "Success";
+ }
+ };
+
+ Content = new StackLayout
+ {
+ Children = {
+
+ panView,
+ _Label
+ }
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index 670f286c..eb9424b6 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -184,6 +184,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43214.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla42602.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43161.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla39768.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla41271.cs" />
<Compile Include="$(MSBuildThisFileDirectory)_Template.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1028.cs" />