summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2017-02-13 12:19:05 +0100
committerGitHub <noreply@github.com>2017-02-13 12:19:05 +0100
commitc2a6bb05b1fe9e530652445e7c8101cfb39155bd (patch)
treed19e20451a6aacaceddf3d5b42e3fa1e419d03e3 /Xamarin.Forms.Xaml.UnitTests
parentd108dfe17652d3f6a18bf76d0b7f955b74244998 (diff)
downloadxamarin-forms-c2a6bb05b1fe9e530652445e7c8101cfb39155bd.tar.gz
xamarin-forms-c2a6bb05b1fe9e530652445e7c8101cfb39155bd.tar.bz2
xamarin-forms-c2a6bb05b1fe9e530652445e7c8101cfb39155bd.zip
[XamlC] complete the Setter/Trigger fix (#737)
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Unreported009.xaml16
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Unreported009.xaml.cs45
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj6
3 files changed, 67 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported009.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported009.xaml
new file mode 100644
index 00000000..62771ef8
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported009.xaml
@@ -0,0 +1,16 @@
+<?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.Unreported009">
+ <ContentPage.Resources>
+ <ResourceDictionary>
+ <Style x:Key="Default" TargetType="ContentView">
+ <Setter Property="Content">
+ <Setter.Value>
+ <Label Text="Bananas!" />
+ </Setter.Value>
+ </Setter>
+ </Style>>
+ </ResourceDictionary>
+ </ContentPage.Resources>
+</ContentPage>
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported009.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported009.xaml.cs
new file mode 100644
index 00000000..e825b5b5
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Unreported009.xaml.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using Xamarin.Forms;
+using Xamarin.Forms.Core.UnitTests;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ public partial class Unreported009 : ContentPage
+ {
+ public Unreported009()
+ {
+ InitializeComponent();
+ }
+
+ public Unreported009(bool useCompiledXaml)
+ {
+ //this stub will be replaced at compile time
+ }
+
+ [TestFixture]
+ class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ Device.PlatformServices = new MockPlatformServices();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ Device.PlatformServices = null;
+ }
+
+ [TestCase(true), TestCase(false)]
+ public void AllowSetterValueAsElementProperties(bool useCompiledXaml)
+ {
+ var p = new Unreported009(useCompiledXaml);
+ var s = p.Resources["Default"] as Style;
+ Assert.AreEqual("Bananas!", (s.Setters[0].Value as Label).Text);
+ }
+ }
+ }
+}
diff --git a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
index 90bab284..dd8cfe4f 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
+++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
@@ -446,6 +446,9 @@
<Compile Include="AcceptEmptyServiceProvider.xaml.cs">
<DependentUpon>AcceptEmptyServiceProvider.xaml</DependentUpon>
</Compile>
+ <Compile Include="Issues\Unreported009.xaml.cs">
+ <DependentUpon>Unreported009.xaml</DependentUpon>
+ </Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" />
@@ -812,6 +815,9 @@
<EmbeddedResource Include="AcceptEmptyServiceProvider.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="Issues\Unreported009.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />