diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2016-12-23 08:50:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-23 08:50:19 +0100 |
commit | b96df000db76ba3490589c37e93224271249bc88 (patch) | |
tree | 6389cd652ebe395b51829ee2ec1d41d285ed2fab /Xamarin.Forms.Xaml.UnitTests | |
parent | 2c91b0facd2a25d0de9a283b44cf818329d4c06f (diff) | |
download | xamarin-forms-b96df000db76ba3490589c37e93224271249bc88.tar.gz xamarin-forms-b96df000db76ba3490589c37e93224271249bc88.tar.bz2 xamarin-forms-b96df000db76ba3490589c37e93224271249bc88.zip |
[Xaml] support short Properties for PropertyCondition (#645)
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/TriggerTests.xaml | 28 | ||||
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/TriggerTests.xaml.cs | 16 |
2 files changed, 36 insertions, 8 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/TriggerTests.xaml b/Xamarin.Forms.Xaml.UnitTests/TriggerTests.xaml index 8d78ba93..a8291e38 100644 --- a/Xamarin.Forms.Xaml.UnitTests/TriggerTests.xaml +++ b/Xamarin.Forms.Xaml.UnitTests/TriggerTests.xaml @@ -1,12 +1,24 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?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.TriggerTests"> <ContentPage.Content> - <Entry x:Name="entry"> - <Entry.Triggers> - <Trigger Property="IsPassword" Value="true" TargetType="Entry"> - <Setter Property="Scale" Value="1.2" /> - </Trigger> - </Entry.Triggers> - </Entry> + <StackLayout> + <Entry x:Name="entry"> + <Entry.Triggers> + <Trigger Property="IsPassword" Value="true" TargetType="Entry"> + <Setter Property="Scale" Value="1.2" /> + </Trigger> + </Entry.Triggers> + </Entry> + <Entry x:Name="entry1"> + <Entry.Triggers> + <MultiTrigger TargetType="Entry"> + <MultiTrigger.Conditions> + <PropertyCondition Value="True" Property="IsPassword" /> + </MultiTrigger.Conditions> + <Setter Property="Scale" Value="1.2" /> + </MultiTrigger> + </Entry.Triggers> + </Entry> + </StackLayout> </ContentPage.Content> </ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/TriggerTests.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/TriggerTests.xaml.cs index 79886f8f..5b6755f5 100644 --- a/Xamarin.Forms.Xaml.UnitTests/TriggerTests.xaml.cs +++ b/Xamarin.Forms.Xaml.UnitTests/TriggerTests.xaml.cs @@ -47,6 +47,22 @@ namespace Xamarin.Forms.Xaml.UnitTests Assert.AreEqual (Entry.IsPasswordProperty, pwTrigger.Property); Assert.AreEqual (true, pwTrigger.Value); } + + [TestCase(false)] + [TestCase(true)] + public void ValueIsConvertedWithPropertyCondition(bool useCompiledXaml) + { + var layout = new TriggerTests(useCompiledXaml); + Entry entry = layout.entry1; + Assert.NotNull(entry); + + var triggers = entry.Triggers; + Assert.IsNotEmpty(triggers); + var pwTrigger = triggers[0] as MultiTrigger; + var pwCondition = pwTrigger.Conditions[0] as PropertyCondition; + Assert.AreEqual(Entry.IsPasswordProperty, pwCondition.Property); + Assert.AreEqual(true, pwCondition.Value); + } } } }
\ No newline at end of file |