diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2016-12-12 10:57:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-12 10:57:01 +0100 |
commit | 22bdca32339838702920802e49465264fcccd48b (patch) | |
tree | d4379b92dd8f59ca18a47f6ea5a3276535150686 /Xamarin.Forms.Xaml.UnitTests | |
parent | f0ea0fa4bf86c7b641d0ddc3c734a5b7971c90f7 (diff) | |
download | xamarin-forms-22bdca32339838702920802e49465264fcccd48b.tar.gz xamarin-forms-22bdca32339838702920802e49465264fcccd48b.tar.bz2 xamarin-forms-22bdca32339838702920802e49465264fcccd48b.zip |
[XamlC] fix loading ulongs, optimize bytecode for ulongs (#611)
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/I8.xaml | 22 | ||||
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/I8.xaml.cs | 77 | ||||
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/MockCompiler.cs | 1 | ||||
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj | 6 |
4 files changed, 106 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/I8.xaml b/Xamarin.Forms.Xaml.UnitTests/I8.xaml new file mode 100644 index 00000000..09f27127 --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/I8.xaml @@ -0,0 +1,22 @@ +<?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.I8" + l0="0" + l1="2147483647" + l2="4294967295" + l3="9223372036854775807" + l4="-2147483647" + l5="-4294967295" + l6="-9223372036854775807" + l7="256" + l8="-256" + l9="127" + ul0="0" + ul1="2147483647" + ul2="4294967295" + ul3="9223372036854775807" + ul4="18446744073709551615" + ul5="256"> +</ContentPage> diff --git a/Xamarin.Forms.Xaml.UnitTests/I8.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/I8.xaml.cs new file mode 100644 index 00000000..4d7d874b --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/I8.xaml.cs @@ -0,0 +1,77 @@ +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 I8 : ContentPage + { + public long l0 { get; set; } + public long l1 { get; set; } + public long l2 { get; set; } + public long l3 { get; set; } + public long l4 { get; set; } + public long l5 { get; set; } + public long l6 { get; set; } + public long l7 { get; set; } + public long l8 { get; set; } + public long l9 { get; set; } + public ulong ul0 { get; set; } + public ulong ul1 { get; set; } + public ulong ul2 { get; set; } + public ulong ul3 { get; set; } + public ulong ul4 { get; set; } + public ulong ul5 { get; set; } + + public I8() + { + InitializeComponent(); + } + + public I8(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + public class Tests + { + [SetUp] + public void Setup() + { + Device.PlatformServices = new MockPlatformServices(); + } + + [TearDown] + public void TearDown() + { + Device.PlatformServices = null; + } + + [TestCase(false)] + [TestCase(true)] + public void I8AreConverted(bool useCompiledXaml) + { + var p = new I8(useCompiledXaml); + Assert.AreEqual(0L, p.l0); + Assert.AreEqual((long)int.MaxValue, p.l1); + Assert.AreEqual((long)uint.MaxValue, p.l2); + Assert.AreEqual(long.MaxValue, p.l3); + Assert.AreEqual((long)-int.MaxValue, p.l4); + Assert.AreEqual((long)-uint.MaxValue, p.l5); + Assert.AreEqual(-long.MaxValue, p.l6); + Assert.AreEqual((long)256, p.l7); + Assert.AreEqual((long)-256, p.l8); + Assert.AreEqual((long)127, p.l9); + Assert.AreEqual(0L, p.ul0); + Assert.AreEqual((long)int.MaxValue, p.ul1); + Assert.AreEqual((long)uint.MaxValue, p.ul2); + Assert.AreEqual(long.MaxValue, p.ul3); + Assert.AreEqual(ulong.MaxValue, p.ul4); + Assert.AreEqual((ulong)256, p.ul5); + } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/MockCompiler.cs b/Xamarin.Forms.Xaml.UnitTests/MockCompiler.cs index ccbfa20a..6e63f6a4 100644 --- a/Xamarin.Forms.Xaml.UnitTests/MockCompiler.cs +++ b/Xamarin.Forms.Xaml.UnitTests/MockCompiler.cs @@ -19,6 +19,7 @@ namespace Xamarin.Forms.Xaml.UnitTests Assembly = assembly, ReferencePath = string.Join(";", refs), KeepXamlResources = true, + OptimizeIL = true, Type = type.FullName }; diff --git a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj index 5ce458c1..2234c7f9 100644 --- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj +++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj @@ -400,6 +400,9 @@ <Compile Include="Issues\Bz46921.xaml.cs"> <DependentUpon>Bz46921.xaml</DependentUpon> </Compile> + <Compile Include="I8.xaml.cs"> + <DependentUpon>I8.xaml</DependentUpon> + </Compile> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" /> @@ -721,6 +724,9 @@ <EmbeddedResource Include="Issues\Bz46921.xaml"> <Generator>MSBuild:UpdateDesignTimeXaml</Generator> </EmbeddedResource> + <EmbeddedResource Include="I8.xaml"> + <Generator>MSBuild:UpdateDesignTimeXaml</Generator> + </EmbeddedResource> </ItemGroup> <ItemGroup> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> |