summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2016-07-21 20:59:40 +0200
committerJason Smith <jason.smith@xamarin.com>2016-07-21 11:59:40 -0700
commit2590d913f7c69f1be60c2c5ac7fb60d0ec8732ed (patch)
tree981c141f8503ecf27531bc94ace0a64dad6e344d /Xamarin.Forms.Xaml.UnitTests
parenta80d5c0de704837588138966be1b38a89ed24be9 (diff)
downloadxamarin-forms-2590d913f7c69f1be60c2c5ac7fb60d0ec8732ed.tar.gz
xamarin-forms-2590d913f7c69f1be60c2c5ac7fb60d0ec8732ed.tar.bz2
xamarin-forms-2590d913f7c69f1be60c2c5ac7fb60d0ec8732ed.zip
[XamlC] Fix the getter of getters (#263)
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Unreported004.xaml7
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Unreported004.xaml.cs53
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj6
3 files changed, 66 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported004.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported004.xaml
new file mode 100644
index 00000000..7ed94589
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported004.xaml
@@ -0,0 +1,7 @@
+´╗┐<?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.Unreported004">
+ <Label x:Name="label" local:Unreported004.SomeProperty="foo" />
+</ContentPage>
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported004.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported004.xaml.cs
new file mode 100644
index 00000000..ff2dac08
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported004.xaml.cs
@@ -0,0 +1,53 @@
+´╗┐using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ public partial class Unreported004 : ContentPage
+ {
+ public Unreported004()
+ {
+ InitializeComponent();
+ }
+
+ public Unreported004(bool useCompiledXaml)
+ {
+ //this stub will be replaced at compile time
+ }
+
+ public static readonly BindableProperty SomePropertyProperty =
+ BindableProperty.Create("SomeProperty", typeof(string),
+ typeof(Unreported004), null);
+
+ public static string GetSomeProperty(BindableObject bindable)
+ {
+ return bindable.GetValue(SomePropertyProperty) as string;
+ }
+
+ public static string GetSomeProperty(BindableObject bindable, object foo)
+ {
+ return null;
+ }
+
+ public static void SetSomeProperty(BindableObject bindable, string value)
+ {
+ bindable.SetValue(SomePropertyProperty, value);
+ }
+
+
+ [TestFixture]
+ class Tests
+ {
+ [TestCase(true), TestCase(false)]
+ public void MultipleGetMethodsAllowed(bool useCompiledXaml)
+ {
+ var page = new Unreported004();
+ Assert.NotNull(page.label);
+ Assert.AreEqual("foo", GetSomeProperty(page.label));
+ }
+ }
+ }
+}
+
diff --git a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
index cd22258c..cf473ff8 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
+++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
@@ -350,6 +350,9 @@
<Compile Include="XamlLoaderGetXamlForTypeTests.xaml.cs">
<DependentUpon>XamlLoaderGetXamlForTypeTests.xaml</DependentUpon>
</Compile>
+ <Compile Include="Issues\Unreported004.xaml.cs">
+ <DependentUpon>Unreported004.xaml</DependentUpon>
+ </Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" />
@@ -623,6 +626,9 @@
<EmbeddedResource Include="XamlLoaderGetXamlForTypeTests.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="Issues\Unreported004.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />