diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2017-04-19 10:37:01 +0200 |
---|---|---|
committer | Stephane Delcroix <stephane@delcroix.org> | 2017-04-19 10:37:01 +0200 |
commit | bd7db64039e54de18a1f845ac70f748efdf367bc (patch) | |
tree | 8983622576d90915c9e759711607d88e2261d988 /Xamarin.Forms.Xaml.UnitTests | |
parent | 892e8d18689edf3eb8a882f0db67e97dc1b98d23 (diff) | |
download | xamarin-forms-bd7db64039e54de18a1f845ac70f748efdf367bc.tar.gz xamarin-forms-bd7db64039e54de18a1f845ac70f748efdf367bc.tar.bz2 xamarin-forms-bd7db64039e54de18a1f845ac70f748efdf367bc.zip |
[Xaml][test] Passing test for Bz55343
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
3 files changed, 83 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz55343.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz55343.xaml new file mode 100644 index 00000000..5abf73f8 --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz55343.xaml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" + x:Class="Xamarin.Forms.Xaml.UnitTests.Bz55343"> + <ContentPage.Resources> + <ResourceDictionary> + <OnPlatform x:Key="HeaderFont" + x:TypeArguments="Font"> + <On Platform="Android" + Value="Large" /> + <On Platform="WinPhone" + Value="Large" /> + <On Platform="iOS" + Value="Large" /> + </OnPlatform> + + <OnPlatform x:Key="HeaderFontSize" + x:TypeArguments="x:Double"> + <On Platform="Android" + Value="60.0" /> + <On Platform="WinPhone" + Value="60.0" /> + <On Platform="iOS" + Value="64.0" /> + </OnPlatform> + </ResourceDictionary> + </ContentPage.Resources> + <StackLayout> + <Label x:Name="label0" Font="{StaticResource HeaderFont}" /> + <Label x:Name="label1" FontSize="{StaticResource HeaderFontSize}" /> + </StackLayout> +</ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz55343.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz55343.xaml.cs new file mode 100644 index 00000000..54eff984 --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz55343.xaml.cs @@ -0,0 +1,45 @@ +using System; +using NUnit.Framework; +using Xamarin.Forms.Core.UnitTests; + +namespace Xamarin.Forms.Xaml.UnitTests +{ + public partial class Bz55343 : ContentPage + { + public Bz55343() + { + InitializeComponent(); + } + + public Bz55343(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + class Tests + { + [SetUp] + public void Setup() + { + Device.PlatformServices = new MockPlatformServices(); + } + + [TearDown] + public void TearDown() + { + Device.PlatformServices = null; + } + + [TestCase(true)] + [TestCase(false)] + public void OnPlatformFontConversion(bool useCompiledXaml) + { + ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = Device.iOS; + var layout = new Bz55343(useCompiledXaml); + Assert.That(layout.label0.FontSize, Is.EqualTo(16d)); + Assert.That(layout.label1.FontSize, Is.EqualTo(64d)); + } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj index a2c9d496..e75487b4 100644 --- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj +++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj @@ -473,6 +473,9 @@ <Compile Include="Issues\Bz53275.xaml.cs"> <DependentUpon>Bz53275.xaml</DependentUpon> </Compile> + <Compile Include="Issues\Bz55343.xaml.cs"> + <DependentUpon>Bz55343.xaml</DependentUpon> + </Compile> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" /> @@ -866,6 +869,9 @@ <EmbeddedResource Include="Issues\Bz53275.xaml"> <Generator>MSBuild:UpdateDesignTimeXaml</Generator> </EmbeddedResource> + <EmbeddedResource Include="Issues\Bz55343.xaml"> + <Generator>MSBuild:UpdateDesignTimeXaml</Generator> + </EmbeddedResource> </ItemGroup> <ItemGroup> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> |