summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38989.cs
blob: a16f1adf0b6024375c4047b7541a79dc2dd4f813 (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
using System.Collections.Generic;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using NUnit.Framework;

#endif

namespace Xamarin.Forms.Controls.Issues
{
	[Preserve(AllMembers = true)]
	[Issue(IssueTracker.Bugzilla, 38989, "[Android] NullReferenceException when using a custom ViewCellRenderer ",
		PlatformAffected.Android)]
	public class Bugzilla38989 : TestContentPage
	{
		const string Success = "If you can see this, the test passed.";

#if UITEST && __ANDROID__
		[Test]
		public void Bugzilla38989Test()
		{
			RunningApp.WaitForElement(q => q.Marked(Success));
		}
#endif

		protected override void Init()
		{
			var successLabel = new Label { Text = Success };

			var lv = new ListView();
			var items = new List<string> { "data", "does not", "matter" };

			lv.ItemTemplate = new DataTemplate(typeof(_38989CustomViewCell));

			lv.ItemsSource = items;

			Content = new StackLayout { Children = { successLabel, lv } };
		}

		[Preserve(AllMembers = true)]
		public class _38989CustomViewCell : ViewCell
		{
			public _38989CustomViewCell()
			{
				var label = new Label();
				label.SetBinding(Label.TextProperty, ".");

				View = label;
			}
		}
	}
}