diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2017-01-25 14:47:27 +0100 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-03-24 13:14:23 +0900 |
commit | c247c695cbd8613d5603ccbada92051a9ea7dbf8 (patch) | |
tree | 61ffc2f8687576377ebe71c73d74001589b9f2af /Xamarin.Forms.Xaml.UnitTests/Issues | |
parent | acf4a77b5a71900463f1e31cad1dab5e9593451e (diff) | |
download | xamarin-forms-c247c695cbd8613d5603ccbada92051a9ea7dbf8.tar.gz xamarin-forms-c247c695cbd8613d5603ccbada92051a9ea7dbf8.tar.bz2 xamarin-forms-c247c695cbd8613d5603ccbada92051a9ea7dbf8.zip |
[Xaml[C]] Do not instantiate DataTemplate Content at parsing time (#683)
* [Xaml] rename VisitChildrenFirst
* [Xaml] rework SkipChildren in XamlNode
* [Xaml] fix 45179
* fix
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/Issues')
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/Issues/Bz27863.xaml.cs | 13 | ||||
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/Issues/Bz27968.xaml.cs | 13 | ||||
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml | 14 | ||||
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml.cs | 55 |
4 files changed, 95 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27863.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27863.xaml.cs index 03ebaaf9..1120a033 100644 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27863.xaml.cs +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27863.xaml.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using Xamarin.Forms; using NUnit.Framework; +using Xamarin.Forms.Core.UnitTests; namespace Xamarin.Forms.Xaml.UnitTests { @@ -22,6 +23,18 @@ namespace Xamarin.Forms.Xaml.UnitTests [TestFixture] class Tests { + [SetUp] + public void Setup() + { + Device.PlatformServices = new MockPlatformServices(); + } + + [TearDown] + public void TearDown() + { + Device.PlatformServices = null; + } + [TestCase(true)] [TestCase(false)] public void DataTemplateInResourceDictionaries (bool useCompiledXaml) diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27968.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27968.xaml.cs index 2482e9f0..507073d7 100644 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27968.xaml.cs +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27968.xaml.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using Xamarin.Forms; using NUnit.Framework; +using Xamarin.Forms.Core.UnitTests; namespace Xamarin.Forms.Xaml.UnitTests { @@ -26,6 +27,18 @@ namespace Xamarin.Forms.Xaml.UnitTests [TestFixture] class Tests { + [SetUp] + public void Setup() + { + Device.PlatformServices = new MockPlatformServices(); + } + + [TearDown] + public void TearDown() + { + Device.PlatformServices = null; + } + [TestCase(true)] [TestCase(false)] public void BaseClassIdentifiersAreValidForResources (bool useCompiledXaml) diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml new file mode 100644 index 00000000..a89aa295 --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml @@ -0,0 +1,14 @@ +<?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.Bz45179"> + <ContentPage.Resources> + <ResourceDictionary> + <DataTemplate x:Key="dt0"> + <local:Bz45179_0/> + </DataTemplate> + </ResourceDictionary> + </ContentPage.Resources> +</ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml.cs new file mode 100644 index 00000000..1dbdb44d --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using Xamarin.Forms; +using Xamarin.Forms.Core.UnitTests; + +namespace Xamarin.Forms.Xaml.UnitTests +{ + public class Bz45179_0 : ContentView { + public static int creator_count; + public Bz45179_0() + { + creator_count++; + } + + } + public partial class Bz45179 : ContentPage + { + public Bz45179() + { + InitializeComponent(); + } + + public Bz45179(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 DTDoNotInstantiateTheirContent(bool useCompiledXaml) + { + Bz45179_0.creator_count = 0; + Assume.That(Bz45179_0.creator_count, Is.EqualTo(0)); + var page = new Bz45179(useCompiledXaml); + Assert.That(Bz45179_0.creator_count, Is.EqualTo(0)); + } + } + } +}
\ No newline at end of file |