diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-04-08 09:16:02 -0700 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-04-08 17:16:02 +0100 |
commit | e9f655688586bc0eb4183507def7ed3f774b7c71 (patch) | |
tree | 24aaba13b7a44468bb0989055813b11fdb5baf6f /Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla40173.cs | |
parent | 870f9c98ffccce86d80c6ff7a05de7238fc1b0e8 (diff) | |
download | xamarin-forms-e9f655688586bc0eb4183507def7ed3f774b7c71.tar.gz xamarin-forms-e9f655688586bc0eb4183507def7ed3f774b7c71.tar.bz2 xamarin-forms-e9f655688586bc0eb4183507def7ed3f774b7c71.zip |
[A] Fix Bugzilla 40173 (#62)
* [A]Fix issue where Frame would block all tap gestures under it even if it didn't have one
* [A]Make BoxView non-blocking inside a ListView only
* Add UITest for bz40173
* Fix code review issues
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla40173.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla40173.cs | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla40173.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla40173.cs new file mode 100644 index 00000000..422e363d --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla40173.cs @@ -0,0 +1,110 @@ +using Xamarin.Forms.CustomAttributes; +#if UITEST +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 40173, "Android BoxView/Frame not clickthrough in ListView")] + public class Bugzilla40173 : TestContentPage // or TestMasterDetailPage, etc ... + { + const string CantTouchButtonId = "CantTouchButtonId"; + const string CanTouchButtonId = "CanTouchButtonId"; + const string ListTapTarget = "ListTapTarget"; + const string CantTouchFailText = "Failed"; + const string CanTouchSuccessText = "ButtonTapped"; + const string ListTapSuccessText = "ItemTapped"; + +#if UITEST + [Test] + public void ButtonBlocked() + { + RunningApp.Tap(q => q.Marked(CantTouchButtonId)); + RunningApp.WaitForNoElement(q => q.Text(CantTouchFailText)); + + RunningApp.Tap(q => q.Marked(CanTouchButtonId)); + RunningApp.WaitForElement(q => q.Text(CanTouchSuccessText)); + + RunningApp.Tap(q => q.Marked(ListTapTarget)); + RunningApp.WaitForElement(q => q.Text(ListTapSuccessText)); + } +#endif + + protected override void Init() + { + var outputLabel = new Label(); + var testButton = new Button + { + Text = "Can't Touch This", + AutomationId = CantTouchButtonId + }; + + testButton.Clicked += (sender, args) => outputLabel.Text = CantTouchFailText; + + var testGrid = new Grid + { + Children = + { + testButton, + new BoxView + { + Color = Color.Pink.MultiplyAlpha(0.5) + } + } + }; + + // BoxView over Button prevents Button click + var testButtonOk = new Button + { + Text = "Can Touch This", + AutomationId = CanTouchButtonId + }; + + testButtonOk.Clicked += (sender, args) => outputLabel.Text = CanTouchSuccessText; + + var testGridOk = new Grid + { + Children = + { + testButtonOk, + new BoxView + { + Color = Color.Pink.MultiplyAlpha(0.5), + InputTransparent = true + } + } + }; + + var testListView = new ListView(); + var items = new[] { "Foo" }; + testListView.ItemsSource = items; + testListView.ItemTemplate = new DataTemplate(() => + { + var result = new ViewCell + { + View = new Grid + { + Children = + { + new BoxView + { + AutomationId = ListTapTarget, + Color = Color.Pink.MultiplyAlpha(0.5) + } + } + } + }; + + return result; + }); + + testListView.ItemSelected += (sender, args) => outputLabel.Text = ListTapSuccessText; + + Content = new StackLayout + { + Children = { outputLabel, testGrid, testGridOk, testListView } + }; + } + } +}
\ No newline at end of file |