summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2017-01-25 15:09:54 +0100
committerGitHub <noreply@github.com>2017-01-25 15:09:54 +0100
commitca7f2caf57b2b4a9705cc02fe51d8a29d9f21da6 (patch)
treec86418662285f56f5260bb7684caf739f73d682c /Xamarin.Forms.Xaml.UnitTests
parentf30aa8ae2c54172df237a80dfff7a6eb0c679195 (diff)
downloadxamarin-forms-ca7f2caf57b2b4a9705cc02fe51d8a29d9f21da6.tar.gz
xamarin-forms-ca7f2caf57b2b4a9705cc02fe51d8a29d9f21da6.tar.bz2
xamarin-forms-ca7f2caf57b2b4a9705cc02fe51d8a29d9f21da6.zip
[XamlC] allow xml-elements as Setter/Trigger Values (#684)
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Bz51567.xaml13
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Bz51567.xaml.cs47
-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/Bz51567.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz51567.xaml
new file mode 100644
index 00000000..844d2d8c
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz51567.xaml
@@ -0,0 +1,13 @@
+<?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.Bz51567">
+ <ContentPage.Resources>
+ <ResourceDictionary>
+ <Style x:Key="ListText" TargetType="Label">
+ <Setter Property="TextColor" Value="Black" />
+ <Setter Property="FontSize">
+ <OnPlatform x:TypeArguments="x:Double" iOS="17" Android="17" WinPhone="20" />
+ </Setter>
+ </Style>
+ </ResourceDictionary>
+ </ContentPage.Resources>
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz51567.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz51567.xaml.cs
new file mode 100644
index 00000000..de64c2d1
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz51567.xaml.cs
@@ -0,0 +1,47 @@
+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 Bz51567 : ContentPage
+ {
+ public Bz51567()
+ {
+ InitializeComponent();
+ }
+
+ public Bz51567(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 SetterWithElementValue(bool useCompiledXaml)
+ {
+ var page = new Bz51567(useCompiledXaml);
+ var style = page.Resources["ListText"] as Style;
+ var setter = style.Setters[1];
+ Assert.NotNull(setter);
+ }
+ }
+ }
+}
diff --git a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
index ae250cd1..ca96e65c 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
+++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
@@ -409,6 +409,9 @@
<Compile Include="Issues\Bz45179.xaml.cs">
<DependentUpon>Bz45179.xaml</DependentUpon>
</Compile>
+ <Compile Include="Issues\Bz51567.xaml.cs">
+ <DependentUpon>Bz51567.xaml</DependentUpon>
+ </Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" />
@@ -739,6 +742,9 @@
<EmbeddedResource Include="Issues\Bz45179.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="Issues\Bz51567.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />