summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UnitTests
diff options
context:
space:
mode:
authoradrianknight89 <adrianknight89@outlook.com>2016-12-06 06:07:29 -0600
committerRui Marinho <me@ruimarinho.net>2016-12-06 12:07:29 +0000
commit9dff4c16508452512c5faa36788f65ba6419170e (patch)
treec10ba4ce6c728e953bf0d94f063cd280197a9c31 /Xamarin.Forms.Core.UnitTests
parent331a7b76db5bc645852b8d50a443f5a205a860d3 (diff)
downloadxamarin-forms-9dff4c16508452512c5faa36788f65ba6419170e.tar.gz
xamarin-forms-9dff4c16508452512c5faa36788f65ba6419170e.tar.bz2
xamarin-forms-9dff4c16508452512c5faa36788f65ba6419170e.zip
[Android] ScrollView should send correct ScrollX and ScrollY (#394)
* Android should show correct ScrollX and ScrollY when scrolling in both directions * Adding sample code to demonstrate scrolling * Orientation fix * ScrollTo should work for horizontal + vertical scrolling * Get correct scroll x and y values for ScrollOrientation.Both * Convert positions to pixels * Adding unit test to watch out for incorrect animation positioning * automated test * improvements * fixed texts
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests')
-rw-r--r--Xamarin.Forms.Core.UnitTests/ScrollViewUnitTests.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/ScrollViewUnitTests.cs b/Xamarin.Forms.Core.UnitTests/ScrollViewUnitTests.cs
index 0ed525c0..46b0e29f 100644
--- a/Xamarin.Forms.Core.UnitTests/ScrollViewUnitTests.cs
+++ b/Xamarin.Forms.Core.UnitTests/ScrollViewUnitTests.cs
@@ -453,5 +453,36 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.AreEqual(100, scroll.Height);
Assert.AreEqual(100, scroll.Width);
}
+
+ [Test]
+ public void TestBackToBackBiDirectionalScroll()
+ {
+ var scrollView = new ScrollView
+ {
+ Orientation = ScrollOrientation.Both,
+ Platform = new UnitPlatform(),
+ Content = new Grid
+ {
+ WidthRequest = 1000,
+ HeightRequest = 1000
+ }
+ };
+
+ var y100Count = 0;
+
+ ((IScrollViewController)scrollView).ScrollToRequested += (sender, args) =>
+ {
+ if (args.ScrollY == 100)
+ {
+ ++y100Count;
+ }
+ };
+
+ scrollView.ScrollToAsync(100, 100, true);
+ Assert.AreEqual(y100Count, 1);
+
+ scrollView.ScrollToAsync(0, 100, true);
+ Assert.AreEqual(y100Count, 2);
+ }
}
}