diff options
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/Issues')
20 files changed, 0 insertions, 708 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27863.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27863.xaml.cs index 1120a033..03ebaaf9 100644 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27863.xaml.cs +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27863.xaml.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using Xamarin.Forms; using NUnit.Framework; -using Xamarin.Forms.Core.UnitTests; namespace Xamarin.Forms.Xaml.UnitTests { @@ -23,18 +22,6 @@ 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 507073d7..2482e9f0 100644 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27968.xaml.cs +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz27968.xaml.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using Xamarin.Forms; using NUnit.Framework; -using Xamarin.Forms.Core.UnitTests; namespace Xamarin.Forms.Xaml.UnitTests { @@ -27,18 +26,6 @@ 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/Bz40906.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz40906.xaml deleted file mode 100644 index cb280fcb..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz40906.xaml +++ /dev/null @@ -1,9 +0,0 @@ -<?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.Bz40906"> - <Label x:Name="label0"> - <![CDATA[Foo]]> - </Label> - <Label x:Name="label1"> - <![CDATA[Foo]]>Bar<![CDATA[>><<]]> - </Label> -</ContentPage> diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz40906.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz40906.xaml.cs deleted file mode 100644 index dd734550..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz40906.xaml.cs +++ /dev/null @@ -1,46 +0,0 @@ -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 Bz40906 : ContentPage - { - public Bz40906() - { - InitializeComponent(); - } - - public Bz40906(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 ParsingCDATA(bool useCompiledXaml) - { - var page = new Bz40906(useCompiledXaml); - Assert.AreEqual("Foo", page.label0.Text); - Assert.AreEqual("FooBar>><<", page.label1.Text); -} - } - } -} diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz42531.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz42531.xaml deleted file mode 100644 index 49c473ca..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz42531.xaml +++ /dev/null @@ -1,24 +0,0 @@ -<?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.Bz42531"> - <ListView x:Name="lv"> - <ListView.ItemTemplate> - <DataTemplate> - <ViewCell> - <StackLayout Orientation="Horizontal"> - <StackLayout.Resources> - <ResourceDictionary> - <Style TargetType="Label"> - <Setter Property="HorizontalOptions" Value="Center"/> - </Style> - </ResourceDictionary> - </StackLayout.Resources> - <Label Text="Example1"/> - <Label Text="2..."/> - </StackLayout> - </ViewCell> - </DataTemplate> - </ListView.ItemTemplate> - </ListView> -</ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz42531.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz42531.xaml.cs deleted file mode 100644 index 380cef6a..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz42531.xaml.cs +++ /dev/null @@ -1,51 +0,0 @@ -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 Bz42531 : ContentPage - { - public Bz42531() - { - InitializeComponent(); - } - - public Bz42531(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 RDInDataTemplates(bool useCompiledXaml) - { - var p = new Bz42531(useCompiledXaml); - ListView lv = p.lv; - var template = lv.ItemTemplate; - var cell = template.CreateContent(null, lv) as ViewCell; - var sl = cell.View as StackLayout; - Assert.AreEqual(1, sl.Resources.Count); - var label = sl.Children[0] as Label; - Assert.AreEqual(LayoutOptions.Center, label.HorizontalOptions); - } - } - } -}
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43694.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43694.xaml deleted file mode 100644 index 9fcc0c00..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43694.xaml +++ /dev/null @@ -1,21 +0,0 @@ -<?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.Bz43694"> - <ContentPage.Resources> - <ResourceDictionary> - <x:String x:Key="Dark">Dark</x:String> - <x:String x:Key="Light"> - <OnPlatform x:TypeArguments="x:String"> - <OnPlatform.iOS>OpenSans-Light</OnPlatform.iOS> - <OnPlatform.Android>OpenSans-Light</OnPlatform.Android> - <OnPlatform.WinPhone>/Assets/Fonts/OpenSans-Light.ttf#Open Sans</OnPlatform.WinPhone> - </OnPlatform> - </x:String> - </ResourceDictionary> - </ContentPage.Resources> - <Label Text="{StaticResource Light}" - VerticalOptions="Center" - HorizontalOptions="Center" - x:Name="label"/> -</ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43694.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43694.xaml.cs deleted file mode 100644 index 62af1c0b..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43694.xaml.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; -using Xamarin.Forms; -using Xamarin.Forms.Core.UnitTests; - -namespace Xamarin.Forms.Xaml.UnitTests -{ - [XamlCompilation(XamlCompilationOptions.Skip)] - public partial class Bz43694 : ContentPage - { - public Bz43694() - { - InitializeComponent(); - } - - public Bz43694(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 xStaticWithOnPlatformChildInRD(bool useCompiledXaml) - { - if (useCompiledXaml) - Assert.Throws(new XamlParseExceptionConstraint(9, 6), () => MockCompiler.Compile(typeof(Bz43694))); - else - Assert.Throws(new XamlParseExceptionConstraint(9, 6), () => new Bz43694(useCompiledXaml)); - } - } - } -}
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43733.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43733.xaml deleted file mode 100644 index eaccfcd9..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43733.xaml +++ /dev/null @@ -1,4 +0,0 @@ -<?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.Bz43733"> - <Label x:Name="label" Text="{StaticResource SharedText}"/> -</ContentPage> diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43733.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43733.xaml.cs deleted file mode 100644 index 2f15579f..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz43733.xaml.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; -using Xamarin.Forms; -using Xamarin.Forms.Core.UnitTests; - -namespace Xamarin.Forms.Xaml.UnitTests -{ - public class Bz43733Rd : ResourceDictionary - { - public Bz43733Rd() - { - Add("SharedText", "Foo"); - } - } - - public partial class Bz43733 : ContentPage - { - public Bz43733() - { - InitializeComponent(); - } - - public Bz43733(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 ThrowOnMissingDictionary(bool useCompiledXaml) - { - Application.Current = new MockApplication { - Resources = new ResourceDictionary { - MergedWith = typeof(Bz43733Rd), - } - }; - var p = new Bz43733(useCompiledXaml); - Assert.AreEqual("Foo", p.label.Text); - } - } - } -} diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44213.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44213.xaml deleted file mode 100644 index 0a932f32..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44213.xaml +++ /dev/null @@ -1,12 +0,0 @@ -<?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.Bz44213"> - <Label x:Name="label"> - <Label.Text> - <OnPlatform x:TypeArguments="BindingBase" Android="{Binding Bar}"> - <OnPlatform.iOS> - <Binding Path="Foo"/> - </OnPlatform.iOS> - </OnPlatform> - </Label.Text> - </Label> -</ContentPage> diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44213.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44213.xaml.cs deleted file mode 100644 index faabad6d..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44213.xaml.cs +++ /dev/null @@ -1,48 +0,0 @@ -using NUnit.Framework; -using Xamarin.Forms.Core.UnitTests; - -namespace Xamarin.Forms.Xaml.UnitTests -{ - public partial class Bz44213 : ContentPage - { - public Bz44213() - { - InitializeComponent(); - } - - public Bz44213(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 BindingInOnPlatform(bool useCompiledXaml) - { - ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = Device.iOS; - var p = new Bz44213(useCompiledXaml); - p.BindingContext = new { Foo = "Foo", Bar = "Bar" }; - Assert.AreEqual("Foo", p.label.Text); - ((MockPlatformServices)Device.PlatformServices).RuntimePlatform = Device.Android; - p = new Bz44213(useCompiledXaml); - p.BindingContext = new { Foo = "Foo", Bar = "Bar" }; - Assert.AreEqual("Bar", p.label.Text); - } - } - } -}
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44216.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44216.xaml deleted file mode 100644 index fd0cfb4d..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44216.xaml +++ /dev/null @@ -1,9 +0,0 @@ -<?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.Bz44216"> - <ContentPage.Behaviors> - <local:Bz44216Behavior MinLengh="5" /> - </ContentPage.Behaviors> -</ContentPage> diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44216.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44216.xaml.cs deleted file mode 100644 index b6ad87b7..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz44216.xaml.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; -using Xamarin.Forms; -using Xamarin.Forms.Core.UnitTests; - -namespace Xamarin.Forms.Xaml.UnitTests -{ - public class Bz44216Behavior : Behavior<ContentPage> - { - static readonly BindableProperty MinLenghProperty = BindableProperty.Create("MinLengh", typeof(int), typeof(Bz44216Behavior), 1); - - public int MinLengh { - get { return (int)base.GetValue(MinLenghProperty); } - private set { base.SetValue(MinLenghProperty, value > 0 ? value : 1); } - } - } - - [XamlCompilation(XamlCompilationOptions.Skip)] - public partial class Bz44216 : ContentPage - { - public Bz44216() - { - InitializeComponent(); - } - - public Bz44216(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 DonSetValueOnPrivateBP(bool useCompiledXaml) - { - if (useCompiledXaml) - Assert.Throws(new XamlParseExceptionConstraint(7, 26, s => s.StartsWith("No property,", StringComparison.Ordinal)), () => MockCompiler.Compile(typeof(Bz44216))); - else - Assert.Throws(new XamlParseExceptionConstraint(7, 26, s=> s.StartsWith("Cannot assign property", StringComparison.Ordinal)), () => new Bz44216(useCompiledXaml)); - } - } - } -} diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml deleted file mode 100644 index a89aa295..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml +++ /dev/null @@ -1,14 +0,0 @@ -<?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 deleted file mode 100644 index 1dbdb44d..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45179.xaml.cs +++ /dev/null @@ -1,55 +0,0 @@ -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 diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45299.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45299.xaml deleted file mode 100644 index daaa8daa..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45299.xaml +++ /dev/null @@ -1,14 +0,0 @@ -<?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.Bz45299"> - <local:Bz45299Control - BackgroundColor="Silver" - HorizontalOptions="FillAndExpand" - VerticalOptions="FillAndExpand" x:Name="ctrl"> - <local:Bz45299Control.PortraitLayout> - <local:Bz45299OrientationLayout Count="3" Spacing="1" /> - </local:Bz45299Control.PortraitLayout> - </local:Bz45299Control> -</ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45299.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45299.xaml.cs deleted file mode 100644 index 791e870f..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45299.xaml.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using System.Collections.Generic; -using NUnit.Framework; -using Xamarin.Forms; -using Xamarin.Forms.Core.UnitTests; - -namespace Xamarin.Forms.Xaml.UnitTests -{ - public class Bz45299Control : ContentView - { - public static readonly BindableProperty PortraitLayoutProperty = - BindableProperty.Create(nameof(PortraitLayout), typeof(Bz45299OrientationLayout), typeof(Bz45299Control)); - public Bz45299OrientationLayout PortraitLayout { - get { return (Bz45299OrientationLayout)GetValue(PortraitLayoutProperty); } - set { this.SetValue(PortraitLayoutProperty, value); } - } - - } - - public class Bz45299OrientationLayout : BindableObject - { - public static readonly BindableProperty SizeProperty = - BindableProperty.Create(nameof(Size), typeof(Bz45299UISize), typeof(Bz45299OrientationLayout), Bz45299UISize.Zero); - public Bz45299UISize Size { - get { return (Bz45299UISize)GetValue(SizeProperty); } - set { SetValue(SizeProperty, value); } - } - - public static readonly BindableProperty SpacingProperty = - BindableProperty.Create(nameof(Spacing), typeof(Bz45299UILength), typeof(Bz45299OrientationLayout), Bz45299UILength.Zero); - public Bz45299UILength Spacing { - get { return (Bz45299UILength)GetValue(SpacingProperty); } - set { SetValue(SpacingProperty, value); } - } - - public static readonly BindableProperty CountProperty = - BindableProperty.Create(nameof(Count), typeof(int), typeof(Bz45299OrientationLayout), 1); - public int Count { - get { return (int)GetValue(CountProperty); } - set { SetValue(CountProperty, value); } - } - } - - [TypeConverter(typeof(Bz45299UILengthTypeConverter))] - public class Bz45299UILength - { - public static Bz45299UILength Zero => new Bz45299UILength { Value = 0 }; - - public double Value { get; set; } - - public static implicit operator string(Bz45299UILength uiLength) => uiLength.Value.ToString(); - public static implicit operator double(Bz45299UILength uiLength) => uiLength.Value; - - public static implicit operator Bz45299UILength(string value) => Zero; - public static implicit operator Bz45299UILength(long value) => Zero; - public static implicit operator Bz45299UILength(ulong value) => Zero; - public static implicit operator Bz45299UILength(int value) => Zero; - public static implicit operator Bz45299UILength(uint value) => Zero; - public static implicit operator Bz45299UILength(double value) => Zero; - public static implicit operator Bz45299UILength(float value) => Zero; - } - - public class Bz45299UILengthTypeConverter : TypeConverter - { - static readonly Type StringType = typeof(string); - public override bool CanConvertFrom(Type sourceType) - { - if (sourceType != StringType) - return false; - - return true; - } - - public override object ConvertFromInvariantString(string value) => Bz45299UILength.Zero; - } - - [TypeConverter(typeof(Bz45299UISizeTypeConverter))] - public class Bz45299UISize - { - public static Bz45299UISize Zero => new Bz45299UISize { Width = 0, Height = 0 }; - - public Bz45299UILength Width { get; set; } - public Bz45299UILength Height { get; set; } - - public static implicit operator Bz45299UISize(string value) => Zero; - public static implicit operator Size(Bz45299UISize uiSize) => new Size(uiSize.Width, uiSize.Height); - public static implicit operator Bz45299UISize(Size size) => new Bz45299UISize { Width = size.Width, Height = size.Height }; - } - - public class Bz45299UISizeTypeConverter : TypeConverter - { - private static readonly Type StringType = typeof(string); - - public override bool CanConvertFrom(Type sourceType) - { - if (sourceType != StringType) - return false; - - return true; - } - - public override object ConvertFromInvariantString(string value) => Bz45299UISize.Zero; - } - - public partial class Bz45299 : ContentPage - { - public Bz45299() - { - InitializeComponent(); - } - public Bz45299(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 XamlCCustomTypeConverter(bool useCompiledXaml) - { - var p = new Bz45299(useCompiledXaml); - Assert.AreEqual(0d, p.ctrl.PortraitLayout.Spacing.Value); - } - } - } -}
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45891.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45891.xaml deleted file mode 100644 index 7a1adf67..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45891.xaml +++ /dev/null @@ -1,17 +0,0 @@ -<?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:sys="clr-namespace:System;assembly=mscorlib" - xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" - xmlns:local="clr-namespace:Xamarin.Forms.Xaml.UnitTests" - x:Class="Xamarin.Forms.Xaml.UnitTests.Bz45891"> - <local:Bz45891.List> - <OnPlatform x:TypeArguments="scg:List(sys:String)"> - <OnPlatform.iOS> - <scg:List x:TypeArguments="sys:String"> - <x:String>Foo</x:String> - </scg:List> - </OnPlatform.iOS> - </OnPlatform> - </local:Bz45891.List> -</ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45891.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45891.xaml.cs deleted file mode 100644 index 4284dde7..00000000 --- a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz45891.xaml.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using NUnit.Framework; -using Xamarin.Forms; -using Xamarin.Forms.Core.UnitTests; - -namespace Xamarin.Forms.Xaml.UnitTests -{ - public partial class Bz45891 : ContentPage - { - public Bz45891() - { - InitializeComponent(); - } - - public Bz45891(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } - - public static readonly BindableProperty ListProperty = - BindableProperty.Create("List", typeof(IEnumerable<string>), typeof(Bz45891), default(IEnumerable<string>)); - - public IEnumerable<string> List { - get { return (IEnumerable<string>)GetValue(ListProperty); } - set { SetValue(ListProperty, value); } - } - - [TestFixture] - class Tests - { - [SetUp] - public void Setup() - { - Device.PlatformServices = new MockPlatformServices(); - } - - [TearDown] - public void TearDown() - { - Device.PlatformServices = null; - } - - [TestCase(true)] - [TestCase(false)] - public void LookForInheritanceOnOpImplicit(bool useCompiledXaml) - { - var p = new Bz45891(useCompiledXaml); - Assert.AreEqual("Foo", p.List.First()); - } - } - } -}
\ No newline at end of file |