diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2016-12-01 22:26:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-01 22:26:05 +0100 |
commit | 00b652cd43902b4499706d1f9172041c20083ae8 (patch) | |
tree | 226ef334a923b05969b410227fe69dc47f6aa9de /Xamarin.Forms.Xaml.UnitTests | |
parent | 46c25a2edbf257153d7bb33d2ac3997a3718e3ee (diff) | |
download | xamarin-forms-00b652cd43902b4499706d1f9172041c20083ae8.tar.gz xamarin-forms-00b652cd43902b4499706d1f9172041c20083ae8.tar.bz2 xamarin-forms-00b652cd43902b4499706d1f9172041c20083ae8.zip |
[Xaml] support non-int enums (#575)
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/SetValue.xaml | 1 | ||||
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/SetValue.xaml.cs | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml b/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml index 75784273..4beec041 100644 --- a/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml +++ b/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml @@ -84,5 +84,6 @@ </ContentView.Content> </ContentView> <local:MockViewWithValues x:Name="mockView0" UShort="32" ADecimal="42" /> + <local:ViewWithEnums x:Name="enums" IntEnum="Foo" ByteEnum="Bar" /> </StackLayout> </ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml.cs index 3343ed7a..c6c362c2 100644 --- a/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml.cs +++ b/Xamarin.Forms.Xaml.UnitTests/SetValue.xaml.cs @@ -20,6 +20,26 @@ namespace Xamarin.Forms.Xaml.UnitTests public decimal ADecimal { get; set; } } + public enum IntEnum + { + Foo, + Bar, + Baz + } + + public enum ByteEnum : byte + { + Foo, + Bar, + Baz + } + + public class ViewWithEnums : View + { + public IntEnum IntEnum { get; set; } + public ByteEnum ByteEnum { get; set; } + } + public partial class SetValue : ContentPage { public SetValue () @@ -243,6 +263,19 @@ namespace Xamarin.Forms.Xaml.UnitTests Assert.AreEqual((ushort)32, page.mockView0.UShort); Assert.AreEqual((decimal)42, page.mockView0.ADecimal); } + + [TestCase(false)] + [TestCase(true)] + public void NonIntEnums(bool useCompiledXaml) + { + if (useCompiledXaml) { + MockCompiler.Compile(typeof(SetValue)); + return; + } + var page = new SetValue(useCompiledXaml); + Assert.AreEqual(IntEnum.Foo, page.enums.IntEnum); + Assert.AreEqual(ByteEnum.Bar, page.enums.ByteEnum); + } } } }
\ No newline at end of file |