summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2017-06-20 09:38:58 -0600
committerRui Marinho <me@ruimarinho.net>2017-06-20 16:38:58 +0100
commitf7c943dc7798b3449d2bf8319aca8a9ab448ffec (patch)
tree7b27d6245816765fb320e130d2995f06a1ec3d78 /Xamarin.Forms.Controls.Issues
parentc0a55911ac66caff70dfbefb83a3dcb69c991025 (diff)
downloadxamarin-forms-f7c943dc7798b3449d2bf8319aca8a9ab448ffec.tar.gz
xamarin-forms-f7c943dc7798b3449d2bf8319aca8a9ab448ffec.tar.bz2
xamarin-forms-f7c943dc7798b3449d2bf8319aca8a9ab448ffec.zip
[iOS] Allow Forms gestures on custom renderers for controls which already have gestures (#990)
* Repro 57114 with UI test; fix for 57114 on iOS * Repro/UI test for Windows * Add helpful comment for posterity * Remove stray TODO * Only do ShouldReceiveTouch on mobile * Explicitly require wrapped UIView to have gesture recognizers
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla57114.cs110
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
2 files changed, 111 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla57114.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla57114.cs
new file mode 100644
index 00000000..353939ea
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla57114.cs
@@ -0,0 +1,110 @@
+using System;
+using System.Diagnostics;
+
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+
+#if UITEST
+using Xamarin.Forms.Core.UITests;
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+#if UITEST
+ [Category(UITestCategories.Gestures)]
+#endif
+
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 57114, "Forms gestures are not supported on UIViews that have native gestures", PlatformAffected.iOS)]
+ public class Bugzilla57114 : TestContentPage
+ {
+ public static string _57114NativeGestureFiredMessage = "_57114NativeGestureFiredMessage";
+
+ Label _results;
+ bool _nativeGestureFired;
+ bool _formsGestureFired;
+
+ const string Testing = "Testing...";
+ const string Success = "Success";
+ const string AutomationId = "_57114View";
+
+ protected override void Init()
+ {
+ var instructions = new Label
+ {
+ Text = $"Tap the Aqua View below. If the label below changes from '{Testing}' to '{Success}', the test has passed."
+ };
+
+ _results = new Label { Text = Testing };
+
+ var view = new _57114View
+ {
+ AutomationId = AutomationId,
+ HeightRequest = 200, WidthRequest = 200,
+ BackgroundColor = Color.Aqua,
+ HorizontalOptions = LayoutOptions.Fill,
+ VerticalOptions = LayoutOptions.Fill
+ };
+
+ var tap = new TapGestureRecognizer
+ {
+ Command = new Command(() =>
+ {
+ _formsGestureFired = true;
+ UpdateResults();
+ })
+ };
+
+ MessagingCenter.Subscribe<object>(this, _57114NativeGestureFiredMessage, NativeGestureFired);
+
+ view.GestureRecognizers.Add(tap);
+
+ var layout = new StackLayout()
+ {
+ HorizontalOptions = LayoutOptions.Fill,
+ VerticalOptions = LayoutOptions.Fill,
+ Children =
+ {
+ instructions, _results, view
+ }
+ };
+
+ Content = layout;
+ }
+
+ void NativeGestureFired(object obj)
+ {
+ _nativeGestureFired = true;
+ UpdateResults();
+ }
+
+ void UpdateResults()
+ {
+ if (_nativeGestureFired && _formsGestureFired)
+ {
+ _results.Text = Success;
+ }
+ else
+ {
+ _results.Text = Testing;
+ }
+ }
+
+ [Preserve(AllMembers = true)]
+ public class _57114View : View
+ {
+ }
+
+#if UITEST
+ [Test]
+ public void _57114BothTypesOfGesturesFire()
+ {
+ RunningApp.WaitForElement(Testing);
+ RunningApp.Tap(AutomationId);
+ RunningApp.WaitForElement(Success);
+ }
+#endif
+ }
+} \ 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 97f26f7f..62b97166 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
@@ -208,6 +208,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla56609.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla55912.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla57317.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla57114.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CarouselAsync.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla34561.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla34727.cs" />