summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2016-12-12 10:14:37 +0100
committerGitHub <noreply@github.com>2016-12-12 10:14:37 +0100
commit1c796c3a9edfa6a5f16689e5e7ea775c8ef21339 (patch)
tree9ad7e425766ea73b18756553cfca4548aee36fef /Xamarin.Forms.Xaml.UnitTests
parent899e2bd591bf33cf99c1db95666f1313ff80565b (diff)
downloadxamarin-forms-1c796c3a9edfa6a5f16689e5e7ea775c8ef21339.tar.gz
xamarin-forms-1c796c3a9edfa6a5f16689e5e7ea775c8ef21339.tar.bz2
xamarin-forms-1c796c3a9edfa6a5f16689e5e7ea775c8ef21339.zip
[XamlC] support setting values on ValueTypes (#596)
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Bz46921.xaml47
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Bz46921.xaml.cs38
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj6
3 files changed, 91 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz46921.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz46921.xaml
new file mode 100644
index 00000000..ff32f203
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz46921.xaml
@@ -0,0 +1,47 @@
+<?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.Bz46921">
+ <ContentPage.Resources>
+ <ResourceDictionary>
+ <Thickness x:Key="thickness0">4,20,4,20</Thickness>
+ <Thickness
+ x:Key="thickness1"
+ Left="4"
+ Top="20"
+ Bottom="20"
+ Right="4"/>
+
+ <Thickness x:Key="thickness2">
+ <Thickness.Left>
+ 4
+ </Thickness.Left>
+ <Thickness.Top>
+ 20
+ </Thickness.Top>
+ <Thickness.Bottom>
+ 20
+ </Thickness.Bottom>
+ <Thickness.Right>
+ 4
+ </Thickness.Right>
+ </Thickness>
+
+ <Thickness x:Key="thickness3">
+ <Thickness.Left>
+ <x:Double>4</x:Double>
+ </Thickness.Left>
+ <Thickness.Top>
+ <x:Double>20</x:Double>
+ </Thickness.Top>
+ <Thickness.Bottom>
+ <x:Double>20</x:Double>
+ </Thickness.Bottom>
+ <Thickness.Right>
+ <x:Double>4</x:Double>
+ </Thickness.Right>
+ </Thickness>
+ </ResourceDictionary>
+ </ContentPage.Resources>
+</ContentPage>
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz46921.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz46921.xaml.cs
new file mode 100644
index 00000000..4f2f04d2
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz46921.xaml.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ public partial class Bz46921 : ContentPage
+ {
+ public Bz46921()
+ {
+ InitializeComponent();
+ }
+
+ public Bz46921(bool useCompiledXaml)
+ {
+ //this stub will be replaced at compile time
+ }
+
+ [TestFixture]
+ class Tests
+ {
+ [TestCase(true)]
+ [TestCase(false)]
+ public void MultipleWaysToCreateAThicknessResource(bool useCompiledXaml)
+ {
+ var page = new Bz46921(useCompiledXaml);
+ foreach (var resname in new string[] { "thickness0", "thickness1", "thickness2", "thickness3", }) {
+ var resource = page.Resources[resname];
+ Assert.That(resource, Is.TypeOf<Thickness>());
+ var thickness = (Thickness)resource;
+ Assert.AreEqual(new Thickness(4, 20, 4, 20), thickness);
+
+ }
+ }
+ }
+ }
+} \ 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 4f56c575..5ce458c1 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
+++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
@@ -397,6 +397,9 @@
<DependentUpon>FactoryMethodMissingMethod.xaml</DependentUpon>
</Compile>
<Compile Include="XamlC\TypeReferenceExtensionsTests.cs" />
+ <Compile Include="Issues\Bz46921.xaml.cs">
+ <DependentUpon>Bz46921.xaml</DependentUpon>
+ </Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" />
@@ -715,6 +718,9 @@
<EmbeddedResource Include="FactoryMethodMissingMethod.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="Issues\Bz46921.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />