summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/DefaultColorToggleTest.cs
blob: 6f6cec09a424cd6f96c3bc2d3155481f9d56d778 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
using Xamarin.Forms.CustomAttributes;

namespace Xamarin.Forms.Controls
{
	[Preserve (AllMembers=true)]
	[Issue (IssueTracker.None, 0, "Default colors toggle test", PlatformAffected.All)]
	public class DefaultColorToggleTest : ContentPage
	{
		Button _buttonColorDefaultToggle;
		Button _buttonColorInitted;
		Label _labelColorDefaultToggle;
		Label _labelColorInitted;

		public DefaultColorToggleTest ()
		{
			_buttonColorDefaultToggle = new Button {
				Text = "Default Button Color"
			};

			_buttonColorInitted = new Button {
				Text = "I should be red",
				TextColor = Color.Red
			};

			_labelColorDefaultToggle = new Label {
				Text = "Default Label Color"
			};

			_labelColorInitted = new Label {
				Text = "I should be blue",
				TextColor = Color.Blue
			};

			_buttonColorDefaultToggle.Clicked += (s, e) => {
				if (_buttonColorDefaultToggle.TextColor == Color.Default) {
					_buttonColorDefaultToggle.TextColor = Color.Red;
					_buttonColorDefaultToggle.Text = "Custom Button Color";
				} else {
					_buttonColorDefaultToggle.TextColor = Color.Default;
					_buttonColorDefaultToggle.Text = "Default Button Color";
				}
				
			};

			_labelColorDefaultToggle.GestureRecognizers.Add (new TapGestureRecognizer{Command = new Command (o=>{
				if (_labelColorDefaultToggle.TextColor == Color.Default) {
					_labelColorDefaultToggle.TextColor = Color.Green;
					_labelColorDefaultToggle.Text = "Custom Label Color";
				} else {
					_labelColorDefaultToggle.TextColor = Color.Default;
					_labelColorDefaultToggle.Text = "Default Label Color";
				}
			})});

			var entryTextColorDefaultToggle = new Entry () { Text = "Default Entry Text Color" };
			var entryTextColorInit = new Entry () { Text = "Should Be Red", TextColor = Color.Red };
			var entryToggleButton = new Button () { Text = "Toggle Entry Color" };
			entryToggleButton.Clicked += (sender, args) => {
				if (entryTextColorDefaultToggle.TextColor.IsDefault) {
					entryTextColorDefaultToggle.TextColor = Color.Fuchsia;
					entryTextColorDefaultToggle.Text = "Should Be Fuchsia";
				} else {
					entryTextColorDefaultToggle.TextColor = Color.Default;
					entryTextColorDefaultToggle.Text = "Default Entry Text Color";
				}
			};

			var entryPlaceholderColorDefaultToggle = new Entry () { Placeholder = "Default Placeholder Color" };
			var entryPlaceholderColorInit = new Entry () { Placeholder = "Should Be Lime", PlaceholderColor = Color.Lime };
			var entryPlaceholderToggleButton = new Button () { Text = "Toggle Placeholder Color" };
			entryPlaceholderToggleButton.Clicked += (sender, args) => {
				if (entryPlaceholderColorDefaultToggle.PlaceholderColor.IsDefault) {
					entryPlaceholderColorDefaultToggle.PlaceholderColor = Color.Lime;
					entryPlaceholderColorDefaultToggle.Placeholder = "Should Be Lime";
				} else {
					entryPlaceholderColorDefaultToggle.PlaceholderColor = Color.Default;
					entryPlaceholderColorDefaultToggle.Placeholder = "Default Placeholder Color";
				}
			};

			var passwordColorDefaultToggle = new Entry () { IsPassword = true, Text = "Default Password Color" };
			var passwordColorInit = new Entry () { IsPassword = true, Text = "Should Be Red", TextColor = Color.Red };
			var passwordToggleButton = new Button () { Text = "Toggle Password Box (Default)" };
			passwordToggleButton.Clicked += (sender, args) => {
				if (passwordColorDefaultToggle.TextColor.IsDefault) {
					passwordColorDefaultToggle.TextColor = Color.Red;
					passwordToggleButton.Text = "Toggle Password Box (Red)";
				} else {
					passwordColorDefaultToggle.TextColor = Color.Default;
					passwordToggleButton.Text = "Toggle Password Box (Default)";
				}
			};

			var searchbarTextColorDefaultToggle = new Entry () { Text = "Default SearchBar Text Color" };
			var searchbarTextColorToggleButton = new Button () { Text = "Toggle SearchBar Color" };
			searchbarTextColorToggleButton.Clicked += (sender, args) => {
				if (searchbarTextColorDefaultToggle.TextColor.IsDefault) {
					searchbarTextColorDefaultToggle.TextColor = Color.Fuchsia;
					searchbarTextColorDefaultToggle.Text = "Should Be Fuchsia";
				} else {
					searchbarTextColorDefaultToggle.TextColor = Color.Default;
					searchbarTextColorDefaultToggle.Text = "Default SearchBar Text Color";
				}
			};

			var searchbarPlaceholderColorDefaultToggle = new Entry () { Placeholder = "Default Placeholder Color" };
			var searchbarPlaceholderToggleButton = new Button () { Text = "Toggle Placeholder Color" };
			searchbarPlaceholderToggleButton .Clicked += (sender, args) => {
				if (searchbarPlaceholderColorDefaultToggle.PlaceholderColor.IsDefault) {
					searchbarPlaceholderColorDefaultToggle.PlaceholderColor = Color.Lime;
					searchbarPlaceholderColorDefaultToggle.Placeholder = "Should Be Lime";
				} else {
					searchbarPlaceholderColorDefaultToggle.PlaceholderColor = Color.Default;
					searchbarPlaceholderColorDefaultToggle.Placeholder = "Default Placeholder Color";
				}
			};

			Title = "Test Color Toggle Page";

			Content = new ScrollView () {
				Content = new StackLayout {
					Children = {
						_buttonColorDefaultToggle,
						_buttonColorInitted,
						_labelColorDefaultToggle,
						_labelColorInitted,
						entryTextColorDefaultToggle,
						entryToggleButton,
						entryTextColorInit,
						entryPlaceholderColorDefaultToggle,
						entryPlaceholderToggleButton,
						entryPlaceholderColorInit,
						passwordColorDefaultToggle,
						passwordToggleButton,
						passwordColorInit,
						searchbarTextColorDefaultToggle,
						searchbarTextColorToggleButton,
						searchbarPlaceholderColorDefaultToggle,
						searchbarPlaceholderToggleButton 
					}
				}
			};
		}

	}
}