summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2016-04-18 18:25:20 +0200
committerRui Marinho <me@ruimarinho.net>2016-04-18 17:25:20 +0100
commit4d279db34812891975aa0e8d73e3d5dd970a692c (patch)
tree7020cb7a12f20f36bd83dd65c902128b831dc139 /Xamarin.Forms.Xaml.UnitTests
parent7dcdfb60a9cf0a13fdbb07973f9049e64f91f311 (diff)
downloadxamarin-forms-4d279db34812891975aa0e8d73e3d5dd970a692c.tar.gz
xamarin-forms-4d279db34812891975aa0e8d73e3d5dd970a692c.tar.bz2
xamarin-forms-4d279db34812891975aa0e8d73e3d5dd970a692c.zip
[C] Allow Multiple Shared RD. (#103)
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/SharedResourceDictionary2.xaml6
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/SharedResourceDictionary2.xaml.cs15
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/TestSharedResourceDictionary.xaml20
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/TestSharedResourceDictionary.xaml.cs9
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj6
5 files changed, 51 insertions, 5 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/SharedResourceDictionary2.xaml b/Xamarin.Forms.Xaml.UnitTests/SharedResourceDictionary2.xaml
new file mode 100644
index 00000000..24a6ecd3
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/SharedResourceDictionary2.xaml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Xamarin.Forms.Xaml.UnitTests.SharedResourceDictionary2">
+ <Style x:Key="sharedStyle2" TargetType="Label">
+ <Setter Property="TextColor" Value="Purple"/>
+ </Style>
+</ResourceDictionary>
diff --git a/Xamarin.Forms.Xaml.UnitTests/SharedResourceDictionary2.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/SharedResourceDictionary2.xaml.cs
new file mode 100644
index 00000000..dab1f1a2
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/SharedResourceDictionary2.xaml.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ public partial class SharedResourceDictionary2 : ResourceDictionary
+ {
+ public SharedResourceDictionary2 ()
+ {
+ InitializeComponent ();
+ }
+ }
+}
diff --git a/Xamarin.Forms.Xaml.UnitTests/TestSharedResourceDictionary.xaml b/Xamarin.Forms.Xaml.UnitTests/TestSharedResourceDictionary.xaml
index eb1eb7e4..c87982f8 100644
--- a/Xamarin.Forms.Xaml.UnitTests/TestSharedResourceDictionary.xaml
+++ b/Xamarin.Forms.Xaml.UnitTests/TestSharedResourceDictionary.xaml
@@ -3,9 +3,19 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Xamarin.Forms.Xaml.UnitTests"
x:Class="Xamarin.Forms.Xaml.UnitTests.TestSharedResourceDictionary">
- <ContentPage.Resources>
- <ResourceDictionary MergedWith="local:SharedResourceDictionary">
- </ResourceDictionary>
- </ContentPage.Resources>
- <Label x:Name="label" Style="{StaticResource sharedfoo}"/>
+ <StackLayout>
+ <ContentView>
+ <ContentView.Resources>
+ <ResourceDictionary MergedWith="local:SharedResourceDictionary"/>
+ </ContentView.Resources>
+ <Label x:Name="label" Style="{StaticResource sharedfoo}"/>
+ </ContentView>
+ <ContentView>
+ <ContentView.Resources>
+ <ResourceDictionary MergedWith="local:SharedResourceDictionary2"/>
+ </ContentView.Resources>
+ <Label x:Name="label2" Style="{StaticResource sharedStyle2}"/>
+ </ContentView>
+ </StackLayout>
+
</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/TestSharedResourceDictionary.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/TestSharedResourceDictionary.xaml.cs
index dff3f893..e12e83b7 100644
--- a/Xamarin.Forms.Xaml.UnitTests/TestSharedResourceDictionary.xaml.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/TestSharedResourceDictionary.xaml.cs
@@ -26,6 +26,15 @@ namespace Xamarin.Forms.Xaml.UnitTests
var layout = new TestSharedResourceDictionary (useCompiledXaml);
Assert.AreEqual (Color.Pink, layout.label.TextColor);
}
+
+ [TestCase (false)]
+ [TestCase (true)]
+ public void NoConflictsBetweenSharedRDs (bool useCompiledXaml)
+ {
+ var layout = new TestSharedResourceDictionary (useCompiledXaml);
+ Assert.AreEqual (Color.Pink, layout.label.TextColor);
+ Assert.AreEqual (Color.Purple, layout.label2.TextColor);
+ }
}
}
} \ 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 54433f56..9c4ba829 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
+++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
@@ -341,6 +341,9 @@
<Compile Include="TestSharedResourceDictionary.xaml.cs">
<DependentUpon>TestSharedResourceDictionary.xaml</DependentUpon>
</Compile>
+ <Compile Include="SharedResourceDictionary2.xaml.cs">
+ <DependentUpon>SharedResourceDictionary2.xaml</DependentUpon>
+ </Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" />
@@ -608,6 +611,9 @@
<EmbeddedResource Include="TestSharedResourceDictionary.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="SharedResourceDictionary2.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />