From 3d85653f270854b4aab82e45e6e58afb760feb85 Mon Sep 17 00:00:00 2001 From: Stephane Delcroix Date: Thu, 1 Dec 2016 22:14:22 +0100 Subject: [XamlC] assigned derived type to generic BP (#566) * [XamlC] assigned derived type to generic BP * [XamlC] fix 48554 * f --- Xamarin.Forms.Xaml.UnitTests/Issues/Bz48554.xaml | 9 +++ .../Issues/Bz48554.xaml.cs | 68 ++++++++++++++++++++++ .../Issues/Unreported006.xaml | 12 ++++ .../Issues/Unreported006.xaml.cs | 37 ++++++++++++ .../Xamarin.Forms.Xaml.UnitTests.csproj | 12 ++++ 5 files changed, 138 insertions(+) create mode 100644 Xamarin.Forms.Xaml.UnitTests/Issues/Bz48554.xaml create mode 100644 Xamarin.Forms.Xaml.UnitTests/Issues/Bz48554.xaml.cs create mode 100644 Xamarin.Forms.Xaml.UnitTests/Issues/Unreported006.xaml create mode 100644 Xamarin.Forms.Xaml.UnitTests/Issues/Unreported006.xaml.cs (limited to 'Xamarin.Forms.Xaml.UnitTests') diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz48554.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz48554.xaml new file mode 100644 index 00000000..805d1bb1 --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz48554.xaml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz48554.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz48554.xaml.cs new file mode 100644 index 00000000..e5b814b0 --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz48554.xaml.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Windows.Input; +using NUnit.Framework; +using Xamarin.Forms; + +namespace Xamarin.Forms.Xaml.UnitTests +{ + public class Bz48554View + { + static List all; + + public static List All { + get { + if (all == null) { + all = new List(); + all.Add("6b+"); + all.Add("6c"); + all.Add("6c+"); + all.Add("7a"); + all.Add("7a+"); + } + return all; + } + set { + all = value; + } + } + } + + public class Bz48554Slider : View + { + public static readonly BindableProperty ValuesProperty = + BindableProperty.Create(nameof(Values), typeof(List), typeof(Bz48554Slider), null); + + public List Values { + get { return (List)GetValue(ValuesProperty); } + set { SetValue(ValuesProperty, value); } + } + } + + public partial class Bz48554 : ContentPage + { + public Bz48554() + { + InitializeComponent(); + } + + public Bz48554(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + class Tests + { + [TestCase(true)] + [TestCase(false)] + public void XStaticWithXamlC(bool useCompiledXaml) + { + Bz48554 page = null; + Assert.DoesNotThrow(()=> page = new Bz48554(useCompiledXaml)); + Assert.NotNull(page.SliderGrades); + Assert.AreEqual(5, page.SliderGrades.Values.Count); + } + } + } +} \ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported006.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported006.xaml new file mode 100644 index 00000000..a1afaf48 --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported006.xaml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported006.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported006.xaml.cs new file mode 100644 index 00000000..657c6ffe --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported006.xaml.cs @@ -0,0 +1,37 @@ +using NUnit.Framework; + +namespace Xamarin.Forms.Xaml.UnitTests +{ + public partial class Unreported006 : ContentPage + { + public Unreported006() + { + InitializeComponent(); + } + + public Unreported006(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + public Layout GenericProperty { + get { return (Layout)GetValue(GenericPropertyProperty); } + set { SetValue(GenericPropertyProperty, value); } + } + + public static readonly BindableProperty GenericPropertyProperty = + BindableProperty.Create(nameof(GenericProperty), typeof(Layout), typeof(Unreported006)); + + [TestFixture] + class Tests + { + [TestCase(true), TestCase(false)] + public void CanAssignGenericBP(bool useCompiledXaml) + { + var page = new Unreported006(); + Assert.NotNull(page.GenericProperty); + Assert.That(page.GenericProperty, Is.TypeOf()); + } + } + } +} \ 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 d4b65438..3708d1f1 100644 --- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj +++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj @@ -379,6 +379,12 @@ Bz47950.xaml + + Unreported006.xaml + + + Bz48554.xaml + @@ -679,6 +685,12 @@ MSBuild:UpdateDesignTimeXaml + + MSBuild:UpdateDesignTimeXaml + + + MSBuild:UpdateDesignTimeXaml + -- cgit v1.2.3