diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2016-04-26 00:03:33 +0200 |
---|---|---|
committer | Samantha Houts <samantha@teamredwall.com> | 2016-04-25 15:03:33 -0700 |
commit | 1a7a25fd76f5f73f649e1da664471c6952337eb1 (patch) | |
tree | e5f429bcb80c6ffa6d9df634fcd07a5580639bce /Xamarin.Forms.Core.UnitTests | |
parent | 843bc4727a40d6ca67127326facf2333f461da2d (diff) | |
download | xamarin-forms-1a7a25fd76f5f73f649e1da664471c6952337eb1.tar.gz xamarin-forms-1a7a25fd76f5f73f649e1da664471c6952337eb1.tar.bz2 xamarin-forms-1a7a25fd76f5f73f649e1da664471c6952337eb1.zip |
Multi style classes (#134)
* [C] StyleClass is IList<string>
* fix docs
* this might be required
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests')
-rw-r--r-- | Xamarin.Forms.Core.UnitTests/StyleTests.cs | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/StyleTests.cs b/Xamarin.Forms.Core.UnitTests/StyleTests.cs index be1c7990..d6927e5c 100644 --- a/Xamarin.Forms.Core.UnitTests/StyleTests.cs +++ b/Xamarin.Forms.Core.UnitTests/StyleTests.cs @@ -7,6 +7,13 @@ namespace Xamarin.Forms.Core.UnitTests [TestFixture] public class StyleTests : BaseTestFixture { + [SetUp] + public void Setup () + { + base.Setup (); + Device.PlatformServices = new MockPlatformServices (); + } + [Test] public void ApplyUnapplyStyle () { @@ -470,7 +477,7 @@ namespace Xamarin.Forms.Core.UnitTests var view = new ContentView { Resources = new ResourceDictionary { classstyle }, Content = new Label { - StyleClass = "fooClass", + StyleClass = new [] {"fooClass"}, Style = style } }; @@ -545,17 +552,17 @@ namespace Xamarin.Forms.Core.UnitTests var button = new Button { - StyleClass = "pink", + StyleClass = new [] {"pink"}, }; var myButton = new MyButton { - StyleClass = "pink", + StyleClass = new [] {"pink"}, }; var label = new Label { - StyleClass = "pink" + StyleClass = new [] {"pink"}, }; var myLabel = new MyLabel { - StyleClass = "pink" + StyleClass = new [] {"pink"}, }; @@ -601,10 +608,10 @@ namespace Xamarin.Forms.Core.UnitTests }; var button = new Button { - StyleClass = "pink", + StyleClass = new [] {"pink"}, }; var label = new Label { - StyleClass = "pink" + StyleClass = new [] {"pink"}, }; var cv = new ContentView { @@ -644,10 +651,10 @@ namespace Xamarin.Forms.Core.UnitTests }; var button = new Button { - StyleClass = "pink", + StyleClass = new [] {"pink"}, }; var label = new Label { - StyleClass = "pink" + StyleClass = new [] {"pink"}, }; var cv = new ContentView { @@ -666,5 +673,35 @@ namespace Xamarin.Forms.Core.UnitTests Assert.AreEqual (Color.Pink, label.BackgroundColor); Assert.AreEqual (Color.Default, label.TextColor); } + + [Test] + public void MultipleStyleClassAreApplied () + { + var pinkStyle = new Style (typeof (Button)) { + Setters = { + new Setter { Property = Button.TextColorProperty, Value = Color.Pink }, + }, + Class = "pink", + ApplyToDerivedTypes = true, + }; + var bigStyle = new Style (typeof (Button)) { + Setters = { + new Setter { Property = Button.FontSizeProperty, Value = 20 }, + }, + Class = "big", + ApplyToDerivedTypes = true, + }; + var button = new Button { + StyleClass = new [] {"pink", "big"}, + }; + + new ContentView { + Resources = new ResourceDictionary { pinkStyle, bigStyle }, + Content = button + }; + + Assert.AreEqual (Color.Pink, button.TextColor); + Assert.AreEqual (20d, button.FontSize); + } } }
\ No newline at end of file |