summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/Issues/Bz28556.xaml.cs
blob: dd5bb3171fe2da3c2689e080003c12f951595df1 (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
using System;
using System.Collections.Generic;

using Xamarin.Forms;

using NUnit.Framework;

namespace Xamarin.Forms.Xaml.UnitTests
{
	public partial class Bz28556 : ContentPage
	{
		public Bz28556 ()
		{
			InitializeComponent ();
		}

		public Bz28556 (bool useCompiledXaml)
		{
			//this stub will be replaced at compile time
		}

		[TestFixture]
		class Tests
		{
			[TestCase(true)]
			[TestCase(false)]
			public void SettersAppliedBeforeTriggers (bool useCompiledXaml)
			{
				var layout = new Bz28556 (useCompiledXaml);

				Assert.AreEqual (Color.Yellow, layout.entry.TextColor);
				Assert.AreEqual (Color.Green, layout.entry.BackgroundColor);

				Assert.AreEqual (Color.Red, layout.disableEntry.TextColor);
				Assert.AreEqual (Color.Purple, layout.disableEntry.BackgroundColor);

				layout.entry.IsEnabled = false;
				layout.disableEntry.IsEnabled = true;

				Assert.AreEqual (Color.Yellow, layout.disableEntry.TextColor);
				Assert.AreEqual (Color.Green, layout.disableEntry.BackgroundColor);

				Assert.AreEqual (Color.Red, layout.entry.TextColor);
				Assert.AreEqual (Color.Purple, layout.entry.BackgroundColor);

				layout.entry.IsEnabled = true;
				layout.disableEntry.IsEnabled = false;

				Assert.AreEqual (Color.Yellow, layout.entry.TextColor);
				Assert.AreEqual (Color.Green, layout.entry.BackgroundColor);

				Assert.AreEqual (Color.Red, layout.disableEntry.TextColor);
				Assert.AreEqual (Color.Purple, layout.disableEntry.BackgroundColor);
			}
		}
	}
}