diff options
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39530.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39530.cs | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39530.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39530.cs new file mode 100644 index 00000000..7f510ab6 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39530.cs @@ -0,0 +1,85 @@ +using Xamarin.Forms.CustomAttributes; + +#if UITEST +using NUnit.Framework; +using Xamarin.UITest.Queries; +using Xamarin.Forms.Core.UITests; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve (AllMembers = true)] + [Issue (IssueTracker.Bugzilla, 39530, "Frames do not handle pan or pinch gestures under AppCompat", PlatformAffected.Android)] + public class Bugzilla39530 : TestContentPage + { + protected override void Init () + { + var taps = new Label { Text = "Taps: 0" }; + var pans = new Label (); + var pinches = new Label (); + + var pangr = new PanGestureRecognizer (); + var tapgr = new TapGestureRecognizer (); + var pinchgr = new PinchGestureRecognizer (); + + var frame = new Frame { + HasShadow = false, + HorizontalOptions = LayoutOptions.Fill, + VerticalOptions = LayoutOptions.Fill, + BackgroundColor = Color.White, + Padding = new Thickness (5), + HeightRequest = 300, + WidthRequest = 300, + AutomationId = "frame" + }; + + var tapCount = 0; + + tapgr.Command = new Command (() => { + tapCount += 1; + taps.Text = $"Taps: {tapCount}"; + }); + + pangr.PanUpdated += (sender, args) => pans.Text = $"Panning: {args.StatusType}"; + + pinchgr.PinchUpdated += (sender, args) => pinches.Text = $"Pinching: {args.Status}"; + + frame.GestureRecognizers.Add (tapgr); + frame.GestureRecognizers.Add (pangr); + frame.GestureRecognizers.Add(pinchgr); + + Content = new StackLayout { + BackgroundColor = Color.Olive, + Children = { taps, pans, pinches, frame } + }; + } + +#if UITEST + [Test] + public void Bugzilla39530PanTest() + { + AppRect frameBounds = RunningApp.Query (q => q.Marked ("frame"))[0].Rect; + RunningApp.Pan (new Drag (frameBounds, frameBounds.X + 10, frameBounds.Y + 10, frameBounds.X + 100, frameBounds.Y + 100, Drag.Direction.LeftToRight)); + + RunningApp.WaitForElement (q => q.Marked ("Panning: Completed")); + } + + [Test] + public void Bugzilla39530PinchTest() + { + RunningApp.PinchToZoomIn ("frame"); + RunningApp.WaitForElement(q => q.Marked("Pinching: Completed")); + } + + [Test] + public void Bugzilla39530TapTest() + { + RunningApp.WaitForElement (q => q.Marked ("frame")); + RunningApp.Tap ("frame"); + RunningApp.WaitForElement (q => q.Marked ("Taps: 1")); + RunningApp.Tap ("frame"); + RunningApp.WaitForElement (q => q.Marked ("Taps: 2")); + } +#endif + } +}
\ No newline at end of file |