summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UnitTests/PanGestureRecognizerUnitTests.cs
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-03-22 20:02:25 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-03-22 23:13:41 (GMT)
commit17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch)
treeb5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Core.UnitTests/PanGestureRecognizerUnitTests.cs
downloadxamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2
Initial import
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests/PanGestureRecognizerUnitTests.cs')
-rw-r--r--Xamarin.Forms.Core.UnitTests/PanGestureRecognizerUnitTests.cs99
1 files changed, 99 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/PanGestureRecognizerUnitTests.cs b/Xamarin.Forms.Core.UnitTests/PanGestureRecognizerUnitTests.cs
new file mode 100644
index 0000000..c0207d6
--- /dev/null
+++ b/Xamarin.Forms.Core.UnitTests/PanGestureRecognizerUnitTests.cs
@@ -0,0 +1,99 @@
+´╗┐using System;
+using NUnit.Framework;
+
+namespace Xamarin.Forms.Core.UnitTests
+{
+
+ public class PanGestureRecognizerUnitTests : BaseTestFixture
+ {
+ [Test]
+ public void PanRaisesStartedEventTest ()
+ {
+ var view = new View ();
+ var pan = new PanGestureRecognizer ();
+
+ GestureStatus target = GestureStatus.Canceled;
+ pan.PanUpdated += (object sender, PanUpdatedEventArgs e) => {
+ target = e.StatusType;
+ };
+
+ ((IPanGestureController)pan).SendPanStarted (view, 0);
+ Assert.AreEqual (GestureStatus.Started, target);
+ }
+
+ [Test]
+ public void PanRaisesRunningEventTest ()
+ {
+ var view = new View ();
+ var pan = new PanGestureRecognizer ();
+
+ GestureStatus target = GestureStatus.Canceled;
+ pan.PanUpdated += (object sender, PanUpdatedEventArgs e) => {
+ target = e.StatusType;
+ };
+
+ ((IPanGestureController)pan).SendPan (view, gestureId: 0, totalX: 5, totalY: 10);
+ Assert.AreEqual (GestureStatus.Running, target);
+ }
+
+ [Test]
+ public void PanRunningEventContainsTotalXTest ()
+ {
+ var view = new View ();
+ var pan = new PanGestureRecognizer ();
+
+ double target = 0;
+ pan.PanUpdated += (object sender, PanUpdatedEventArgs e) => {
+ target = e.TotalX;
+ };
+
+ ((IPanGestureController)pan).SendPan (view, gestureId: 0, totalX: 5, totalY: 10);
+ Assert.AreEqual (5, target);
+ }
+
+ [Test]
+ public void PanRunningEventContainsTotalYTest ()
+ {
+ var view = new View ();
+ var pan = new PanGestureRecognizer ();
+
+ double target = 0;
+ pan.PanUpdated += (object sender, PanUpdatedEventArgs e) => {
+ target = e.TotalY;
+ };
+
+ ((IPanGestureController)pan).SendPan (view, gestureId: 0, totalX: 5, totalY: 10);
+ Assert.AreEqual (10, target);
+ }
+
+ [Test]
+ public void PanRaisesCompletedEventTest ()
+ {
+ var view = new View ();
+ var pan = new PanGestureRecognizer ();
+
+ GestureStatus target = GestureStatus.Canceled;
+ pan.PanUpdated += (object sender, PanUpdatedEventArgs e) => {
+ target = e.StatusType;
+ };
+
+ ((IPanGestureController)pan).SendPanCompleted (view, 0);
+ Assert.AreEqual (GestureStatus.Completed, target);
+ }
+
+ [Test]
+ public void PanRaisesCanceledEventTest ()
+ {
+ var view = new View ();
+ var pan = new PanGestureRecognizer ();
+
+ GestureStatus target = GestureStatus.Started;
+ pan.PanUpdated += (object sender, PanUpdatedEventArgs e) => {
+ target = e.StatusType;
+ };
+
+ ((IPanGestureController)pan).SendPanCanceled (view, 0);
+ Assert.AreEqual (GestureStatus.Canceled, target);
+ }
+ }
+} \ No newline at end of file