From 1c796c3a9edfa6a5f16689e5e7ea775c8ef21339 Mon Sep 17 00:00:00 2001 From: Stephane Delcroix Date: Mon, 12 Dec 2016 10:14:37 +0100 Subject: [XamlC] support setting values on ValueTypes (#596) --- Xamarin.Forms.Xaml.UnitTests/Issues/Bz46921.xaml | 47 ++++++++++++++++++++++ .../Issues/Bz46921.xaml.cs | 38 +++++++++++++++++ .../Xamarin.Forms.Xaml.UnitTests.csproj | 6 +++ 3 files changed, 91 insertions(+) create mode 100644 Xamarin.Forms.Xaml.UnitTests/Issues/Bz46921.xaml create mode 100644 Xamarin.Forms.Xaml.UnitTests/Issues/Bz46921.xaml.cs (limited to 'Xamarin.Forms.Xaml.UnitTests') 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 @@ + + + + + 4,20,4,20 + + + + + 4 + + + 20 + + + 20 + + + 4 + + + + + + 4 + + + 20 + + + 20 + + + 4 + + + + + 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()); + 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 @@ FactoryMethodMissingMethod.xaml + + Bz46921.xaml + @@ -715,6 +718,9 @@ MSBuild:UpdateDesignTimeXaml + + MSBuild:UpdateDesignTimeXaml + -- cgit v1.2.3