summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2017-09-15 18:49:19 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-09-15 19:28:38 (GMT)
commitfc3ad54edbe4f7e33e2d8c4f9bc217b93dd62ecc (patch)
treee63d0d922f62198993735c34811ede1a0d69f1b8 /Xamarin.Forms.Controls.Issues
parentd1bf93be200b3d3c48d0d292bf455f444485d8f9 (diff)
downloadxamarin-forms-fc3ad54edbe4f7e33e2d8c4f9bc217b93dd62ecc.zip
xamarin-forms-fc3ad54edbe4f7e33e2d8c4f9bc217b93dd62ecc.tar.gz
xamarin-forms-fc3ad54edbe4f7e33e2d8c4f9bc217b93dd62ecc.tar.bz2
[Android] Restore pinch gestures and fix listview item selection (#1135)
* Repro * Fail test if tap command is executed more than once. * Update error message * Handle context actions and taps without breaking selection * Fix 58833 test * Prevent InnerGestureListener from swallowing clicks and preventing selection * Repro for 57515 * Add gestures category to appropriate tests * Test notes * Restore the tap gesture handling * Better test name * Simplify InnerGestureListener constructor; handle OnDown only if listening * OnInterceptTouchEvent for IsEnabled handling * Fix incorrect class filter in TapGestureHandler * Restore MotionEventHelper * Add IsEnabled check on OnTouchEvent * Reinstate pinch gestures * Checkpoint (trying to figure out how to handle button elevation) * Rip out elevation ordering in DefaultRenderer * Working version of pinch-to-zoom test * Clean up lazy initializers, remove unnecessary members * One fewer Java.Lang.Object * Fix issue number; clean up notes and issue number changes * Remove conditional * Restore correct issue number * Automate all the options for 58833 test * Remove unnecessary automation ID * Formatting cleanup; reinstate gesture detector dispose checks * Updating Xamarin UI test version to avoid iOS crashes; update test to open iOS context actions * Attempting to get 58833 test running on all iOS versions
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla24574.cs17
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla25943.cs4
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35477.cs5
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36703.cs13
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39530.cs4
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39768.cs5
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44044.cs5
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46363.cs19
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46458.cs2
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla55912.cs5
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla57515.cs147
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla58833.cs131
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GestureBubblingTests.cs5
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems2
14 files changed, 352 insertions, 12 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla24574.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla24574.cs
index 30916a8..d476a99 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla24574.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla24574.cs
@@ -1,30 +1,35 @@
using System;
-
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, 24574, "Tap Double Tap")]
- public class Issue24574 : TestContentPage // or TestMasterDetailPage, etc ...
+ public class Issue24574 : TestContentPage
{
protected override void Init ()
{
var label = new Label {
AutomationId = "TapLabel",
- Text = "123"
+ Text = "123",
+ FontSize = 50
};
- var rec = new TapGestureRecognizer () { NumberOfTapsRequired = 1 };
+ var rec = new TapGestureRecognizer { NumberOfTapsRequired = 1 };
rec.Tapped += (s, e) => { label.Text = "Single"; };
label.GestureRecognizers.Add (rec);
- rec = new TapGestureRecognizer () { NumberOfTapsRequired = 2 };
+ rec = new TapGestureRecognizer { NumberOfTapsRequired = 2 };
rec.Tapped += (s, e) => { label.Text = "Double"; };
label.GestureRecognizers.Add (rec);
@@ -33,7 +38,7 @@ namespace Xamarin.Forms.Controls.Issues
#if UITEST
[Test]
- public void Issue1Test ()
+ public void TapThenDoubleTap ()
{
RunningApp.Screenshot ("I am at Issue 24574");
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla25943.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla25943.cs
index 1b91a36..cc7664f 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla25943.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla25943.cs
@@ -11,9 +11,11 @@ namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.InputTransparent)]
+ [Category(UITestCategories.Gestures)]
#endif
[Preserve(AllMembers = true)]
- [Issue(IssueTracker.Bugzilla, 25943, "[Android] TapGestureRecognizer does not work with a nested StackLayout", PlatformAffected.Android)]
+ [Issue(IssueTracker.Bugzilla, 25943,
+ "[Android] TapGestureRecognizer does not work with a nested StackLayout", PlatformAffected.Android)]
public class Bugzilla25943 : TestContentPage
{
Label _result;
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35477.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35477.cs
index 5fc92ce..4649358 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35477.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35477.cs
@@ -3,11 +3,16 @@ using Xamarin.Forms.Internals;
#if UITEST
using NUnit.Framework;
+using Xamarin.Forms.Core.UITests;
using Xamarin.UITest.Queries;
#endif
namespace Xamarin.Forms.Controls.Issues
{
+#if UITEST
+ [Category(UITestCategories.Gestures)]
+#endif
+
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Bugzilla, 35477, "Tapped event does not fire when added to Frame in Android AppCompat",
PlatformAffected.Android)]
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36703.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36703.cs
index 47b4d02..0dc3df9 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36703.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36703.cs
@@ -4,12 +4,19 @@ 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
+ [Category(UITestCategories.Gestures)]
+ [Category(UITestCategories.IsEnabled)]
+#endif
+
[Preserve(AllMembers = true)]
- [Issue(IssueTracker.Bugzilla, 36703, "TapGestureRecognizer inside initially disable Image will never fire Tapped event", PlatformAffected.All)]
+ [Issue(IssueTracker.Bugzilla, 36703,
+ "TapGestureRecognizer inside initially disable Image will never fire Tapped event", PlatformAffected.All)]
public class Bugzilla36703 : TestContentPage
{
const string TestImage = "testimage";
@@ -22,7 +29,9 @@ namespace Xamarin.Forms.Controls.Issues
var image = new Image { Source = "coffee.png", IsEnabled = false, AutomationId = TestImage };
var button = new Button { Text = $"Toggle IsEnabled (now {image.IsEnabled})", AutomationId = Toggle };
var resultLabel = new Label { Text = "Testing..."};
- var instructions = new Label { Text = $"Tap the image. The '{Testing}' label should remain unchanged. Tap the 'Toggle IsEnabled' button. Now tap the image again. The {Testing} Label should change its text to {Success}." };
+ var instructions = new Label { Text = $"Tap the image. The '{Testing}' label should remain unchanged. "
+ + $"Tap the 'Toggle IsEnabled' button. Now tap the image again."
+ + $" The {Testing} Label should change its text to {Success}." };
button.Clicked += (sender, args) =>
{
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
index 6b7d380..cc17290 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39530.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39530.cs
@@ -9,6 +9,10 @@ using Xamarin.Forms.Core.UITests;
namespace Xamarin.Forms.Controls.Issues
{
+#if UITEST
+ [Category(UITestCategories.Gestures)]
+#endif
+
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Bugzilla, 39530, "Frames do not handle pan or pinch gestures under AppCompat", PlatformAffected.Android)]
public class Bugzilla39530 : TestContentPage
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39768.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39768.cs
index ae36578..05e88ed 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39768.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39768.cs
@@ -5,10 +5,15 @@ using System;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
+using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls
{
+#if UITEST
+ [Category(UITestCategories.Gestures)]
+#endif
+
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 39768, "PanGestureRecognizer sometimes won't fire completed event when dragging very slowly")]
public class Bugzilla39768 : TestContentPage
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44044.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44044.cs
index 22f8b7b..8d8b08c 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44044.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44044.cs
@@ -6,10 +6,15 @@ using Xamarin.Forms.PlatformConfiguration;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
+using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
+#if UITEST
+ [Category(UITestCategories.Gestures)]
+#endif
+
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 44044, "TabbedPage steals swipe gestures", PlatformAffected.Android)]
public class Bugzilla44044 : TestTabbedPage
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46363.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46363.cs
index 708968d..91b7a95 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46363.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46363.cs
@@ -10,6 +10,12 @@ using NUnit.Framework;
namespace Xamarin.Forms.Controls.Issues
{
+#if UITEST
+ [Category(UITestCategories.Gestures)]
+ [Category(UITestCategories.ListView)]
+ [Category(UITestCategories.Cells)]
+#endif
+
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 46363, "TapGestureRecognizer blocks List View Context Actions", PlatformAffected.Android)]
public class Bugzilla46363 : TestContentPage
@@ -17,6 +23,7 @@ namespace Xamarin.Forms.Controls.Issues
const string Target = "Two";
const string ContextAction = "Context Action";
const string TapSuccess = "Tap Success";
+ const string TapFailure = "Tap command executed more than once";
const string ContextSuccess = "Context Menu Success";
const string Testing = "Testing";
@@ -25,7 +32,7 @@ namespace Xamarin.Forms.Controls.Issues
protected override void Init()
{
- var list = new List<string> { "One", Target, "Two", "Three" };
+ var list = new List<string> { "One", Target, "Three", "Four" };
var lv = new ListView
{
@@ -38,7 +45,15 @@ namespace Xamarin.Forms.Controls.Issues
s_tapCommand = new Command(() =>
{
- result.Text = TapSuccess;
+ if (result.Text == TapSuccess || result.Text == TapFailure)
+ {
+ // We want this test to fail if the tap command is executed more than once
+ result.Text = TapFailure;
+ }
+ else
+ {
+ result.Text = TapSuccess;
+ }
});
s_contextCommand = new Command(() =>
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46458.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46458.cs
index 8863770..2fde0e0 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46458.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46458.cs
@@ -98,7 +98,7 @@ namespace Xamarin.Forms.Controls.Issues
#if UITEST
[Test]
- public void Issue1Test()
+ public void GridIsEnabled()
{
RunningApp.WaitForElement(q => q.Marked("entry"));
RunningApp.Tap(q => q.Marked("entry"));
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla55912.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla55912.cs
index b5a65d8..0a2ee05 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla55912.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla55912.cs
@@ -4,11 +4,16 @@ using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using NUnit.Framework;
+using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
+#if UITEST
+ [Category(UITestCategories.Gestures)]
+#endif
+
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 55912, "Tap event not always propagated to containing Grid/StackLayout",
PlatformAffected.Android)]
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla57515.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla57515.cs
new file mode 100644
index 0000000..b9f3c3e
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla57515.cs
@@ -0,0 +1,147 @@
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using System;
+#if UITEST
+using Xamarin.UITest;
+using Xamarin.Forms.Core.UITests;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+#if UITEST
+ [Category(UITestCategories.Gestures)]
+#endif
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 57515, "PinchGestureRecognizer not getting called on Android ", PlatformAffected.Android)]
+ public class Bugzilla57515 : TestContentPage
+ {
+ const string ZoomImage = "zoomImg";
+ const string ZoomContainer = "zoomContainer";
+
+ protected override void Init()
+ {
+ var layout = new Grid
+ {
+ RowDefinitions = new RowDefinitionCollection
+ {
+ new RowDefinition { Height = 80 },
+ new RowDefinition { Height = GridLength.Star }
+ }
+ };
+
+ var scaleLabel = new Label();
+ layout.Children.Add(scaleLabel);
+
+ var pinchToZoomContainer = new PinchToZoomContainer
+ {
+ Margin = new Thickness(80),
+ AutomationId = ZoomContainer,
+ Content = new Image
+ {
+ AutomationId = ZoomImage,
+ Source = ImageSource.FromFile("oasis.jpg")
+ }
+ };
+
+ Grid.SetRow(pinchToZoomContainer, 1);
+ layout.Children.Add(pinchToZoomContainer);
+
+ scaleLabel.BindingContext = pinchToZoomContainer;
+ scaleLabel.SetBinding(Label.TextProperty, new Binding("CurrentScale"));
+
+ Content = layout;
+ }
+
+ class PinchToZoomContainer : ContentView
+ {
+ public static readonly BindableProperty CurrentScaleProperty =
+ BindableProperty.Create("CurrentScale", typeof(double), typeof(PinchToZoomContainer), 1.0);
+
+ public double CurrentScale
+ {
+ get { return (double)GetValue(CurrentScaleProperty); }
+ set { SetValue(CurrentScaleProperty, value); }
+ }
+
+ double startScale = 1;
+ double xOffset = 0;
+ double yOffset = 0;
+
+ public PinchToZoomContainer()
+ {
+ var pinchGesture = new PinchGestureRecognizer();
+ pinchGesture.PinchUpdated += OnPinchUpdated;
+ GestureRecognizers.Add(pinchGesture);
+ }
+
+ void OnPinchUpdated(object sender, PinchGestureUpdatedEventArgs e)
+ {
+ if (e.Status == GestureStatus.Started)
+ {
+ // Store the current scale factor applied to the wrapped user interface element,
+ // and zero the components for the center point of the translate transform.
+ startScale = Content.Scale;
+ Content.AnchorX = 0;
+ Content.AnchorY = 0;
+ }
+ if (e.Status == GestureStatus.Running)
+ {
+ // Calculate the scale factor to be applied.
+ CurrentScale += (e.Scale - 1) * startScale;
+ CurrentScale = Math.Max(1, CurrentScale);
+
+ // The ScaleOrigin is in relative coordinates to the wrapped user interface element,
+ // so get the X pixel coordinate.
+ double renderedX = Content.X + xOffset;
+ double deltaX = renderedX / Width;
+ double deltaWidth = Width / (Content.Width * startScale);
+ double originX = (e.ScaleOrigin.X - deltaX) * deltaWidth;
+
+ // The ScaleOrigin is in relative coordinates to the wrapped user interface element,
+ // so get the Y pixel coordinate.
+ double renderedY = Content.Y + yOffset;
+ double deltaY = renderedY / Height;
+ double deltaHeight = Height / (Content.Height * startScale);
+ double originY = (e.ScaleOrigin.Y - deltaY) * deltaHeight;
+
+ // Calculate the transformed element pixel coordinates.
+ double targetX = xOffset - (originX * Content.Width) * (CurrentScale - startScale);
+ double targetY = yOffset - (originY * Content.Height) * (CurrentScale - startScale);
+
+ // Apply translation based on the change in origin.
+ Content.TranslationX = targetX.Clamp(-Content.Width * (CurrentScale - 1), 0);
+ Content.TranslationY = targetY.Clamp(-Content.Height * (CurrentScale - 1), 0);
+
+ // Apply scale factor
+ Content.Scale = CurrentScale;
+ }
+ if (e.Status == GestureStatus.Completed)
+ {
+ // Store the translation delta's of the wrapped user interface element.
+ xOffset = Content.TranslationX;
+ yOffset = Content.TranslationY;
+ }
+ }
+ }
+
+#if UITEST
+ [Test]
+ public void Bugzilla57515Test()
+ {
+ RunningApp.WaitForElement(ZoomContainer);
+ RunningApp.WaitForElement("1");
+ RunningApp.PinchToZoomIn(ZoomContainer);
+ RunningApp.WaitForNoElement("1"); // The scale should have changed during the zoom
+ }
+#endif
+ }
+
+ public static class DoubleExtensions
+ {
+ public static double Clamp(this double self, double min, double max)
+ {
+ return Math.Min(max, Math.Max(self, min));
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla58833.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla58833.cs
new file mode 100644
index 0000000..9979227
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla58833.cs
@@ -0,0 +1,131 @@
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+#if UITEST
+using Xamarin.Forms.Core.UITests;
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+#if UITEST
+ [Category(UITestCategories.Gestures)]
+ [Category(UITestCategories.ListView)]
+ [Category(UITestCategories.Cells)]
+#endif
+
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 58833, "ListView SelectedItem Binding does not fire", PlatformAffected.Android)]
+ public class Bugzilla58833 : TestContentPage
+ {
+ const string ItemSelectedSuccess = "ItemSelected Success";
+ const string TapGestureSucess = "TapGesture Fired";
+ Label _resultLabel;
+ static Label s_tapGestureFired;
+
+ [Preserve(AllMembers = true)]
+ class TestCell : ViewCell
+ {
+ readonly Label _content;
+
+ internal static int s_index;
+
+ public TestCell()
+ {
+ _content = new Label();
+
+ if (s_index % 2 == 0)
+ {
+ _content.GestureRecognizers.Add(new TapGestureRecognizer
+ {
+ Command = new Command(() =>
+ {
+ s_tapGestureFired.Text = TapGestureSucess;
+ })
+ });
+ }
+
+ View = _content;
+ ContextActions.Add(new MenuItem { Text = s_index++ + " Action" });
+ }
+
+ protected override void OnBindingContextChanged()
+ {
+ base.OnBindingContextChanged();
+ _content.Text = (string)BindingContext;
+ }
+ }
+
+ protected override void Init()
+ {
+ TestCell.s_index = 0;
+
+ _resultLabel = new Label { Text = "Testing..." };
+ s_tapGestureFired = new Label { Text = "Testing..." };
+
+ var items = new List<string>();
+ for (int i = 0; i < 5; i++)
+ items.Add($"Item #{i}");
+
+ var list = new ListView
+ {
+ ItemTemplate = new DataTemplate(typeof(TestCell)),
+ ItemsSource = items
+ };
+ list.ItemSelected += List_ItemSelected;
+
+ Content = new StackLayout
+ {
+ Children = {
+ _resultLabel,
+ s_tapGestureFired,
+ list
+ }
+ };
+ }
+
+ void List_ItemSelected(object sender, SelectedItemChangedEventArgs e)
+ {
+ _resultLabel.Text = ItemSelectedSuccess;
+ }
+
+#if UITEST
+ protected override bool Isolate => true;
+
+ [Test]
+ public void Bugzilla58833Test()
+ {
+ // Item #1 should not have a tap gesture, so it should be selectable
+ RunningApp.WaitForElement(q => q.Marked("Item #1"));
+ RunningApp.Tap(q => q.Marked("Item #1"));
+ RunningApp.WaitForElement(q => q.Marked(ItemSelectedSuccess));
+
+ // Item #2 should have a tap gesture
+ RunningApp.WaitForElement(q => q.Marked("Item #2"));
+ RunningApp.Tap(q => q.Marked("Item #2"));
+ RunningApp.WaitForElement(q => q.Marked(TapGestureSucess));
+
+ // Both items should allow access to the context menu
+ RunningApp.ActivateContextMenu("Item #2");
+ RunningApp.WaitForElement("2 Action");
+#if __ANDROID__
+ RunningApp.Back();
+#else
+ RunningApp.Tap(q => q.Marked("Item #3"));
+#endif
+
+ RunningApp.ActivateContextMenu("Item #1");
+ RunningApp.WaitForElement("1 Action");
+#if __ANDROID__
+ RunningApp.Back();
+#else
+ RunningApp.Tap(q => q.Marked("Item #3"));
+#endif
+
+ }
+#endif
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GestureBubblingTests.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GestureBubblingTests.cs
index 145fbf8..3873621 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GestureBubblingTests.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GestureBubblingTests.cs
@@ -8,6 +8,7 @@ using Xamarin.Forms.Internals;
#if UITEST
using NUnit.Framework;
using Xamarin.UITest.Queries;
+using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
@@ -17,6 +18,10 @@ namespace Xamarin.Forms.Controls.Issues
// will trigger the frame's tap gesture; for most controls it will not (the control itself absorbs the tap),
// but for non-interactive controls (box, frame, image, label) the gesture bubbles up to the container.
+#if UITEST
+ [Category(UITestCategories.Gestures)]
+#endif
+
[Preserve(AllMembers = true)]
[Issue(IssueTracker.None, 00100100, "Verify that the tap gesture bubbling behavior is consistent across the platforms", PlatformAffected.All)]
public class GestureBubblingTests : TestNavigationPage
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 6b128ca..6d25e7e 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
@@ -213,9 +213,11 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla55912.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla57317.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla57114.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla57515.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla57758.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla57910.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla58406.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla58833.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla59248.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ButtonBackgroundColorTest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CarouselAsync.cs" />