summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-10-04 09:43:44 -0700
committerRui Marinho <me@ruimarinho.net>2016-10-04 17:50:43 +0100
commite5fb49aebe7d55a9056feb536b5a83bc42bad1c3 (patch)
treeb143439b66afc75b0ac95bd923937d6b90715fe3 /Xamarin.Forms.Controls.Issues
parent162c2c0a67990e236b662865edc038edfc804e58 (diff)
downloadxamarin-forms-e5fb49aebe7d55a9056feb536b5a83bc42bad1c3.tar.gz
xamarin-forms-e5fb49aebe7d55a9056feb536b5a83bc42bad1c3.tar.bz2
xamarin-forms-e5fb49aebe7d55a9056feb536b5a83bc42bad1c3.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.projitems2
2 files changed, 89 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 f7f89173..8c84c527 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
@@ -183,6 +183,8 @@
<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" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1075.cs" />