summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32040.cs
blob: b92a8d1aaa1fe70ac046222377ab031ae2e2c402 (plain)
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
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
{
#if UITEST
	[Category(UITestCategories.Cells)]
#endif

	[Preserve (AllMembers = true)]
	[Issue (IssueTracker.Bugzilla, 32040, "EntryCell.Tapped or SwitchCell.Tapped does not fire when within a TableView ")]
	public class Bugzilla32040 : TestContentPage // or TestMasterDetailPage, etc ...
	{
		protected override void Init ()
		{
			var switchCell = new SwitchCell { Text = "blahblah" };
			switchCell.Tapped += (s, e) =>
			{
				switchCell.Text = "Tapped";
			};
			switchCell.OnChanged += (sender, e) => {
				switchCell.Text = "Switched";
			};

			var entryCell = new EntryCell { Text = "yaddayadda" };
#pragma warning disable 618
			entryCell.XAlign = TextAlignment.End;
#pragma warning restore 618
			entryCell.Label = "Click Here";
			entryCell.Tapped += (s, e) =>
			{
				entryCell.Text = "Tapped";
			};
			entryCell.Completed += (sender, e) => {
				entryCell.Text = "Completed";
			};

			// The root page of your application
			Content = new TableView {
				Intent = TableIntent.Form,
				Root = new TableRoot ("Table Title") {
					new TableSection ("Section 1 Title") {
						switchCell,
						entryCell
					}
				}
			};
		}
#if UITEST
		[Test]
		public void TappedWorksForEntryAndSwithCellTest ()
		{
			RunningApp.Tap (q => q.Marked ("blahblah"));
			RunningApp.Tap (q => q.Marked ("Click Here"));
			Assert.GreaterOrEqual (RunningApp.Query (q => q.Marked ("Tapped")).Length, 2);
		}
#endif
	}
}