summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue935.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue935.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue935.cs83
1 files changed, 83 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue935.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue935.cs
new file mode 100644
index 00000000..6ddc21bc
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue935.cs
@@ -0,0 +1,83 @@
+´╗┐using System.Diagnostics;
+using Xamarin.Forms.CustomAttributes;
+
+#if UITEST
+using NUnit.Framework;
+using Xamarin.UITest;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ public class Person
+ {
+ public string Name { get; set; }
+
+ public Person (string name)
+ {
+ Name = name;
+ }
+ }
+
+
+ public class CustomViewCell : ViewCell
+ {
+
+ public CustomViewCell ()
+ {
+ int tapsFired = 0;
+
+ Height = 50;
+
+ var label = new Label {
+ Text = "I have been selected:"
+ };
+
+ Tapped += (s, e) => {
+ tapsFired++;
+ label.Text = "I have been selected:" + tapsFired;
+ };
+
+ View = label;
+ }
+ }
+
+ [Preserve (AllMembers=true)]
+ [Issue (IssueTracker.Github, 935, "ViewCell.ItemTapped only fires once for ListView.SelectedItem", PlatformAffected.Android)]
+ public class Issue935 : TestContentPage
+ {
+ protected override void Init ()
+ {
+ Title = "List Page";
+
+ var items = new [] {
+ new CustomViewCell (),
+ };
+
+ var cellTemplate = new DataTemplate (typeof(CustomViewCell));
+
+ var list = new ListView () {
+ ItemTemplate = cellTemplate,
+ ItemsSource = items
+ };
+
+ Content = list;
+ }
+
+#if UITEST
+ [Test]
+ [Description ("Verify that OnTapped is fired every time a ViewCell is tapped")]
+ [UiTest (typeof(ViewCell))]
+ [UiTest (typeof(ListView))]
+ [UiTest (typeof(ListView), "SelectedItem")]
+ public void Issue935TestsMultipleOnTappedViewCell ()
+ {
+ RunningApp.Tap (q => q.Marked ("I have been selected:"));
+ RunningApp.Screenshot ("Tapped Cell Once");
+ RunningApp.Tap (q => q.Marked ("I have been selected:1"));
+ RunningApp.WaitForElement (q => q.Marked ("I have been selected:2"));
+ RunningApp.Screenshot ("Tapped Cell Twice");
+ }
+#endif
+
+ }
+}