-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Bugzilla59863_2.cs
102 lines (87 loc) · 2.71 KB
/
Bugzilla59863_2.cs
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
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[NUnit.Framework.Category(Core.UITests.UITestCategories.UwpIgnore)]
[Category(UITestCategories.Gestures)]
[NUnit.Framework.Category(Core.UITests.UITestCategories.Bugzilla)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 59863, "TapGestureRecognizer extremely finicky", PlatformAffected.Android,
issueTestNumber: 2)]
public class Bugzilla59863_2 : TestContentPage
{
int _mixedSingleTaps;
int _mixedDoubleTaps;
const string MixedTapBoxId = "mixedTapView";
const string Singles = "singles(s)";
const string Doubles = "double(s)";
protected override void Init()
{
var instructions = new Label
{
Text = "Tap the box below once. The single tap counter should increment. "
+ "Double tap the box. The double tap counter should increment, "
+ "but the single tap counter should not."
};
var mixedSingleTapCounter = new Label { Text = $"{_mixedSingleTaps} {Singles}" };
var mixedDoubleTapCounter = new Label { Text = $"{_mixedDoubleTaps} {Doubles}" };
var mixedTapBox = new BoxView
{
WidthRequest = 100,
HeightRequest = 100,
BackgroundColor = Color.Coral,
AutomationId = MixedTapBoxId
};
var mixedDoubleTap = new TapGestureRecognizer
{
NumberOfTapsRequired = 2,
Command = new Command(() =>
{
_mixedDoubleTaps = _mixedDoubleTaps + 1;
mixedDoubleTapCounter.Text = $"{_mixedDoubleTaps} {Doubles} on {MixedTapBoxId}";
})
};
var mixedSingleTap = new TapGestureRecognizer
{
NumberOfTapsRequired = 1,
Command = new Command(() =>
{
_mixedSingleTaps = _mixedSingleTaps + 1;
mixedSingleTapCounter.Text = $"{_mixedSingleTaps} {Singles} on {MixedTapBoxId}";
})
};
mixedTapBox.GestureRecognizers.Add(mixedDoubleTap);
mixedTapBox.GestureRecognizers.Add(mixedSingleTap);
Content = new StackLayout
{
Margin = 40,
HorizontalOptions = LayoutOptions.Fill,
VerticalOptions = LayoutOptions.Fill,
Children = { instructions, mixedTapBox, mixedSingleTapCounter, mixedDoubleTapCounter }
};
}
#if UITEST
[Test]
public void DoubleTapWithMixedRecognizersShouldRegisterDoubleTap()
{
RunningApp.WaitForElement(MixedTapBoxId);
RunningApp.DoubleTap(MixedTapBoxId);
RunningApp.WaitForElement($"1 {Doubles} on {MixedTapBoxId}");
}
[Test]
public void SingleTapWithMixedRecognizersShouldRegisterSingleTap()
{
RunningApp.WaitForElement(MixedTapBoxId);
RunningApp.Tap(MixedTapBoxId);
RunningApp.WaitForElement($"1 {Singles} on {MixedTapBoxId}");
}
#endif
}
}