diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2016-12-05 13:40:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-05 13:40:12 +0100 |
commit | f9a44ed5ba4db08d0855570a9ed6a618b6b80c56 (patch) | |
tree | d8a496ccfaf7682bba1bfb25d5024b0ec1a364a2 /Xamarin.Forms.Xaml.UnitTests | |
parent | 1a5bead2f2e24cc16da23753eaf0882d38d54ea1 (diff) | |
download | xamarin-forms-f9a44ed5ba4db08d0855570a9ed6a618b6b80c56.tar.gz xamarin-forms-f9a44ed5ba4db08d0855570a9ed6a618b6b80c56.tar.bz2 xamarin-forms-f9a44ed5ba4db08d0855570a9ed6a618b6b80c56.zip |
[XamlC] Compile ContraintTypeConverters (#592)
* [XamlC] Compile ContraintTypeConverters
* fix error message
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml | 6 | ||||
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml.cs | 23 |
2 files changed, 15 insertions, 14 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml b/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml index 56d7e082..b1630646 100644 --- a/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml +++ b/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml @@ -1,9 +1,11 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?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.CompiledTypeConverter" RectangleP="0,1,2,4" RectangleBP="4,8,16,32" BackgroundColor="Pink"> - <Label HorizontalOptions="EndAndExpand" /> + <Label x:Name="label" + HorizontalOptions="EndAndExpand" + RelativeLayout.XConstraint="2" /> </ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml.cs index 092d67de..834a55c9 100644 --- a/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml.cs +++ b/Xamarin.Forms.Xaml.UnitTests/CompiledTypeConverter.xaml.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; - -using Xamarin.Forms; -using NUnit.Framework; +using NUnit.Framework; namespace Xamarin.Forms.Xaml.UnitTests { @@ -31,14 +27,17 @@ namespace Xamarin.Forms.Xaml.UnitTests [TestFixture] public class Tests { - [TestCase (false)] - [TestCase (true)] - public void CompiledTypeConverterAreInvoked (bool useCompiledXaml) + [TestCase(false)] + [TestCase(true)] + public void CompiledTypeConverterAreInvoked(bool useCompiledXaml) { - var p = new CompiledTypeConverter (useCompiledXaml); - Assert.AreEqual (new Rectangle (0, 1, 2, 4), p.RectangleP); - Assert.AreEqual (new Rectangle (4, 8, 16, 32), p.RectangleBP); - Assert.AreEqual (Color.Pink, p.BackgroundColor); + var p = new CompiledTypeConverter(useCompiledXaml); + Assert.AreEqual(new Rectangle(0, 1, 2, 4), p.RectangleP); + Assert.AreEqual(new Rectangle(4, 8, 16, 32), p.RectangleBP); + Assert.AreEqual(Color.Pink, p.BackgroundColor); + Assert.AreEqual(LayoutOptions.EndAndExpand, p.label.GetValue(View.HorizontalOptionsProperty)); + var xConstraint = RelativeLayout.GetXConstraint(p.label); + Assert.AreEqual(2, xConstraint.Compute(null)); } } } |