1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
}
}
|