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

#if UITEST && __ANDROID__
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 && __ANDROID__
[assembly: NUnit.Framework.Category("Issues")]
#endif

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST && __ANDROID__
	[Ignore("Ignoring this test until FastRenderers.LabelRenderer is no longer sealed")]
#endif
	[Preserve(AllMembers = true)]
	[Issue(IssueTracker.None, 0, "Android shows . in empty labels because of a11y Name/HelpText", PlatformAffected.Android)]
	public class AndroidHelpText : TestContentPage
	{
		[Preserve(AllMembers = true)]
		public class HintLabel : Label
		{
			public const string Success = "SUCCESS";
		}

		protected override void Init()
		{
			var label = new Label
			{
				Text = $"There should be an empty label below this one. If the label shows a period (.), this test has failed. There should also be a label that says \"{HintLabel.Success}\"."
			};

			var emptyLabel = new Label { HorizontalTextAlignment = TextAlignment.Center };

			var customLabel = new HintLabel { HorizontalTextAlignment = TextAlignment.Center }; ;

			Content = new StackLayout { Children = { label, emptyLabel, customLabel } };
		}

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