diff options
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); + } } } |