summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/Issues/Issue3076.xaml.cs
blob: e44a134983ed398d587d1bd636c061f5f43b51dc (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
using Xamarin.Forms;

using NUnit.Framework;

namespace Xamarin.Forms.Xaml.UnitTests
{
	public class Issue3076Button : Button
	{
		public static readonly BindableProperty VerticalContentAlignmentProperty =
			BindableProperty.Create ("VerticalContentAlignemnt", typeof(TextAlignment), typeof(Issue3076Button), TextAlignment.Center);

		public TextAlignment VerticalContentAlignment
		{
			get { return (TextAlignment)GetValue (VerticalContentAlignmentProperty); }
			set { SetValue (VerticalContentAlignmentProperty, value); }
		}
	}

	public partial class Issue3076 : ContentPage
	{
		public Issue3076 ()
		{
			InitializeComponent ();
		}

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

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

				Assert.That (layout.local, Is.TypeOf<Issue3076Button> ());
				Assert.AreEqual (TextAlignment.Start, layout.local.VerticalContentAlignment);
			}

			[TestCase (false)]
			[TestCase (true)]
			public void CanUseBindableObjectDefinedInOtherAssembly (bool useCompiledXaml)
			{
				var layout = new Issue3076 (useCompiledXaml);

				Assert.That (layout.controls, Is.TypeOf<Controls.Issue3076Button> ());
				Assert.AreEqual (TextAlignment.Start, layout.controls.HorizontalContentAlignment);
			}
		}
	}
}