From: Stephane Delcroix Date: Fri, 2 Dec 2016 20:36:10 +0000 (+0100) Subject: [XamlC] passing test for 47703 X-Git-Tag: 2.3.3.175~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=badc701871a1190d6acb3495d3cefa93cff810c5;p=platform%2Fupstream%2Fxamarin-forms.git [XamlC] passing test for 47703 --- diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz47703.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz47703.xaml new file mode 100644 index 0000000..75da95a --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz47703.xaml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz47703.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz47703.xaml.cs new file mode 100644 index 0000000..a661e3d --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz47703.xaml.cs @@ -0,0 +1,63 @@ +using System; +using System.Globalization; +using NUnit.Framework; + +namespace Xamarin.Forms.Xaml.UnitTests +{ + public class Bz47703Converter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + return "Label:" + value; + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return value; + } + } + + public class Bz47703View : Label + { + BindingBase displayBinding; + + public BindingBase DisplayBinding { + get { return displayBinding; } + set { + displayBinding = value; + if (displayBinding != null) + this.SetBinding(TextProperty, DisplayBinding); + } + } + } + + public partial class Bz47703 : ContentPage + { + public Bz47703() + { + InitializeComponent(); + } + + public Bz47703(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + class Tests + { + [TestCase(true)] + [TestCase(false)] + public void IValueConverterOnBindings(bool useCompiledXaml) + { + if (useCompiledXaml) + MockCompiler.Compile(typeof(Bz47703)); + var page = new Bz47703(useCompiledXaml); + page.BindingContext = new { Name = "Foo" }; + Assert.AreEqual("Label:Foo", page.view.Text); + } + } + } +} \ 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 7886649..9c2776e 100644 --- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj +++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj @@ -388,6 +388,9 @@ Unreported007.xaml + + Bz47703.xaml + @@ -697,6 +700,9 @@ MSBuild:UpdateDesignTimeXaml + + MSBuild:UpdateDesignTimeXaml +