summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/Issues
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/Issues')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml8
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml.cs57
2 files changed, 65 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml
new file mode 100644
index 00000000..cab52a02
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml
@@ -0,0 +1,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"
+ xmlns:local="clr-namespace:Xamarin.Forms.Xaml.UnitTests"
+ x:Class="Xamarin.Forms.Xaml.UnitTests.Bz53275"
+ ANonBindableProperty="{local:TargetProperty}">
+ <Label x:Name="label" Text="{local:TargetProperty}" />
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml.cs
new file mode 100644
index 00000000..ccef92dd
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Reflection;
+using NUnit.Framework;
+using Xamarin.Forms.Core.UnitTests;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ public class TargetPropertyExtension : IMarkupExtension
+ {
+ public object ProvideValue(IServiceProvider serviceProvider)
+ {
+ var targetProperty = (serviceProvider?.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget)?.TargetProperty;
+ return (targetProperty as BindableProperty)?.PropertyName ?? (targetProperty as PropertyInfo)?.Name;
+ }
+ }
+
+ public partial class Bz53275 : ContentPage
+ {
+ public Bz53275()
+ {
+ InitializeComponent();
+ }
+
+ public Bz53275(bool useCompiledXaml)
+ {
+ //this stub will be replaced at compile time
+ }
+
+ public string ANonBindableProperty { get; set; }
+
+ [TestFixture]
+ class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ Device.PlatformServices = new MockPlatformServices();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ Device.PlatformServices = null;
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void TargetPropertyIsSetOnMarkups(bool useCompiledXaml)
+ {
+ var page = new Bz53275(useCompiledXaml);
+ Assert.AreEqual("ANonBindableProperty", page.ANonBindableProperty);
+ var l0 = page.label;
+ Assert.AreEqual("Text", l0.Text);
+ }
+ }
+ }
+} \ No newline at end of file