summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39331.cs
blob: d58c752b362250079f44c8cb0726fff4d40cfe5b (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
67
68
69
70
71
using System;

using Xamarin.Forms.CustomAttributes;

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

namespace Xamarin.Forms.Controls
{
	[Preserve (AllMembers = true)]
	[Issue (IssueTracker.Bugzilla, 39331, "[Android] BoxView Is InputTransparent Even When Set to False")]
	public class Bugzilla39331 : TestContentPage
	{
		View _busyBackground;
		Button _btnLogin;

		protected override void Init ()
		{
			AbsoluteLayout layout = new AbsoluteLayout {
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
			};

			BackgroundColor = Color.FromUint (0xFFDBDBDB);

			_btnLogin = new Button {
				HorizontalOptions = LayoutOptions.FillAndExpand,

				Text = "Press me",
				BackgroundColor = Color.FromUint (0xFF6E932D),
				TextColor = Color.White,
			};
			_btnLogin.Clicked += BtnLogin_Clicked;
			layout.Children.Add (_btnLogin, new Rectangle (0.5f, 0.5f, 0.25f, 0.25f), AbsoluteLayoutFlags.All);

			_busyBackground = new BoxView {
				BackgroundColor = new Color (0, 0, 0, 0.5f),
				IsVisible = false,
				InputTransparent = false
			};
			layout.Children.Add (_busyBackground, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.SizeProportional);

			Content = layout;
		}

		void BtnLogin_Clicked (object sender, EventArgs e)
		{
			
			if (!_busyBackground.IsVisible) {
				_btnLogin.Text = "Blocked?";
				_busyBackground.IsVisible = true;
			} else {
				_btnLogin.Text = "Guess Not";
				_busyBackground.IsVisible = false;
			}
		}

#if UITEST
		[Test]
		public void Bugzilla34912Test ()
		{
			RunningApp.Tap (q => q.Marked ("Press me"));
			RunningApp.WaitForElement (q => q.Marked ("Blocked?"));
			RunningApp.Tap (q => q.Marked ("Blocked?"));
			RunningApp.WaitForNoElement (q => q.Marked ("Guess Not"));
		}
#endif
	}
}