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

	[Preserve(AllMembers = true)]
	[Issue(IssueTracker.Bugzilla, 57717, "Setting background color on Button in Android FormsApplicationActivity causes NRE", PlatformAffected.Android)]
	public class ButtonBackgroundColorTest : TestContentPage
	{
		const string ButtonText = "I am a button";

		protected override void Init()
		{
			var layout = new StackLayout();

			var instructions = new Label { Text = "If you can see this, the test has passed." };

			var button = new Button { Text = ButtonText, BackgroundColor = Color.CornflowerBlue };

			layout.Children.Add(instructions);
			layout.Children.Add(button);

			Content = layout;
		}

#if UITEST
		[Test]
		public void ButtonBackgroundColorAutomatedTest()
		{
			// With the original bug in place, we'll crash before we get this far
			RunningApp.WaitForElement(ButtonText);
		}
#endif
	}
}