summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1594.cs
blob: cd942319d7c7aad775b239ca565a073eeefb5ce0 (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
using System;
using NUnit.Framework;

namespace Xamarin.Forms.Xaml.UnitTests
{
	[TestFixture]
	public class Issue1594
	{
		[Test]
		public void OnPlatformForButtonHeight ()
		{
			var xaml = @"
				<Button 
					xmlns=""http://xamarin.com/schemas/2014/forms"" 
					xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml"" 
					xmlns:sys=""clr-namespace:System;assembly=mscorlib""
					x:Name=""activateButton"" Text=""ACTIVATE NOW"" TextColor=""White"" BackgroundColor=""#00A0FF"">
				        <Button.HeightRequest>
				           <OnPlatform x:TypeArguments=""sys:Double""
				                   iOS=""33""
				                   Android=""44""
				                   WinPhone=""44"" />
				         </Button.HeightRequest>
				 </Button>";

			Device.OS = TargetPlatform.iOS;
			var button = new Button ().LoadFromXaml (xaml);
			Assert.AreEqual (33, button.HeightRequest);

			Device.OS = TargetPlatform.Android;
			button = new Button ().LoadFromXaml (xaml);
			Assert.AreEqual (44, button.HeightRequest);

			Device.OS = TargetPlatform.WinPhone;
			button = new Button ().LoadFromXaml (xaml);
			Assert.AreEqual (44, button.HeightRequest);


		}

	}
}