summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla52533.cs
blob: c7c31fcfbcfc1d915d6dcf2f9c1044a2fb0575ca (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
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using System.Linq;

#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif

// Apply the default category of "Issues" to all of the tests in this assembly
// We use this as a catch-all for tests which haven't been individually categorized
#if UITEST
[assembly: NUnit.Framework.Category("Issues")]
#endif

namespace Xamarin.Forms.Controls.Issues
{
	[Preserve(AllMembers = true)]
	[Issue(IssueTracker.Bugzilla, 52533, "System.ArgumentException: NaN is not a valid value for width", PlatformAffected.iOS)]
	public class Bugzilla52533 : TestContentPage
	{
		const string LabelId = "label";

		protected override void Init()
		{
			Content = new ListView { ItemTemplate = new DataTemplate(typeof(GridViewCell)), ItemsSource = Enumerable.Range(0, 10) };
		}

		[Preserve(AllMembers = true)]
		class GridViewCell : ViewCell
		{

			public GridViewCell()
			{
				var grid = new Grid
				{
					// Multiple rows
					RowDefinitions = {
						new RowDefinition { Height = new GridLength(20, GridUnitType.Absolute) },
						new RowDefinition { Height = new GridLength(150, GridUnitType.Absolute) }
					},
					// Dynamic width
					ColumnDefinitions = {
						new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }
					}
				};

				// Infinitely wide + Label
				var horStack = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "If this does not crash, this test has passed.", AutomationId = LabelId } } };
				grid.Children.Add(horStack, 0, 0);

				View = grid;
			}
		}

#if UITEST
		[Test]
		public void Bugzilla52533Test()
		{
			RunningApp.WaitForElement(q => q.Marked(LabelId));
		}
#endif
	}
}