diff options
author | adrianknight89 <adrianknight89@outlook.com> | 2016-10-25 12:07:57 -0500 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-10-25 18:07:57 +0100 |
commit | b4a46d482f4b511de7e829f1cfe16aa81057560a (patch) | |
tree | 6d3323d136f973b41e3c9f555adf6f1c60afec71 /Xamarin.Forms.Core.UnitTests | |
parent | 6196407f8924463e526bc96f6855560954d9d2e0 (diff) | |
download | xamarin-forms-b4a46d482f4b511de7e829f1cfe16aa81057560a.tar.gz xamarin-forms-b4a46d482f4b511de7e829f1cfe16aa81057560a.tar.bz2 xamarin-forms-b4a46d482f4b511de7e829f1cfe16aa81057560a.zip |
ScrollView should account for Content margin (#392)
* ScrollView should account for Content margin
* Unit tests for content margin
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests')
-rw-r--r-- | Xamarin.Forms.Core.UnitTests/ScrollViewUnitTests.cs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/ScrollViewUnitTests.cs b/Xamarin.Forms.Core.UnitTests/ScrollViewUnitTests.cs index 066d4e5d..0ed525c0 100644 --- a/Xamarin.Forms.Core.UnitTests/ScrollViewUnitTests.cs +++ b/Xamarin.Forms.Core.UnitTests/ScrollViewUnitTests.cs @@ -399,5 +399,59 @@ namespace Xamarin.Forms.Core.UnitTests Assert.That (scroll.ScrollX, Is.EqualTo (100)); Assert.That (scroll.ScrollY, Is.EqualTo (100)); } + + [Test] + public void TestScrollContentMarginHorizontal() + { + View view = new View { IsPlatformEnabled = true, Margin = 100, WidthRequest = 100, HeightRequest = 100 }; + + var scroll = new ScrollView + { + Content = view, + Orientation = ScrollOrientation.Horizontal, + Platform = new UnitPlatform() + }; + scroll.Layout(new Rectangle(0, 0, 100, 100)); + + Assert.AreEqual(new Size(300, 100), scroll.ContentSize); + Assert.AreEqual(100, scroll.Height); + Assert.AreEqual(100, scroll.Width); + } + + [Test] + public void TestScrollContentMarginVertical() + { + View view = new View { IsPlatformEnabled = true, Margin = 100, WidthRequest = 100, HeightRequest = 100 }; + + var scroll = new ScrollView + { + Content = view, + Orientation = ScrollOrientation.Vertical, + Platform = new UnitPlatform() + }; + scroll.Layout(new Rectangle(0, 0, 100, 100)); + + Assert.AreEqual(new Size(100, 300), scroll.ContentSize); + Assert.AreEqual(100, scroll.Height); + Assert.AreEqual(100, scroll.Width); + } + + [Test] + public void TestScrollContentMarginBiDirectional() + { + View view = new View { IsPlatformEnabled = true, Margin = 100, WidthRequest = 100, HeightRequest = 100 }; + + var scroll = new ScrollView + { + Content = view, + Orientation = ScrollOrientation.Both, + Platform = new UnitPlatform() + }; + scroll.Layout(new Rectangle(0, 0, 100, 100)); + + Assert.AreEqual(new Size(300, 300), scroll.ContentSize); + Assert.AreEqual(100, scroll.Height); + Assert.AreEqual(100, scroll.Width); + } } } |