summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/FontConverterTests.cs
blob: ce8d55e41ba95c9648d3218f563b38ef034112c9 (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
using NUnit.Framework;
using Xamarin.Forms.Core.UnitTests;

namespace Xamarin.Forms.Xaml.UnitTests
{
	[TestFixture]
	public class FontConverterTests : BaseTestFixture
	{
		[TestCase ("Bold", Forms.FontAttributes.Bold)]
		[TestCase ("Italic", Forms.FontAttributes.Italic)]
		[TestCase ("Bold, Italic", Forms.FontAttributes.Bold | Forms.FontAttributes.Italic)]
		public void FontAttributes (string attributeString, FontAttributes result)
		{
			var xaml = @"
			<Label 
				xmlns=""http://xamarin.com/schemas/2014/forms""
				xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" FontAttributes=""" + result + @""" />";

			Device.PlatformServices = new MockPlatformServices ();

			var label = new Label ().LoadFromXaml (xaml);

			Assert.AreEqual (result, label.FontAttributes);
#pragma warning disable 618
			Assert.AreEqual (result, label.Font.FontAttributes);
#pragma warning restore 618
		}
	}
}