public void IdentifyZoomInGesture() { ZoomGripGesture target = new ZoomGripGesture(); bool expected = false; bool actual; var rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 1, 0); var leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1, 0); var spine = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 0.5f, 0); actual = target.IdentifyZoomGesture(rightHand, leftHand, spine, false, false); Assert.AreEqual(expected, actual); actual = target.IdentifyZoomGesture(rightHand, leftHand, spine, true, true); Assert.AreEqual(expected, actual); rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1.1f, 1, 0); leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1, 0); actual = target.IdentifyZoomGesture(rightHand, leftHand, spine, true, true); expected = true; Assert.AreEqual(expected, actual); Assert.AreEqual(GestureEvents.ZOOM_IN, target.Name); }
//12cm distance limit public void ShouldNotStartTrackingZoomWhenHandsAreTooDistantInY() { ZoomGripGesture target = new ZoomGripGesture(); bool expected = false; bool actual; var rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 1.1201f, 0); var leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1, 0); var spine = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 0.5f, 0); actual = target.IdentifyZoomGesture(rightHand, leftHand, spine, false, false); Assert.AreEqual(expected, actual); actual = target.IdentifyZoomGesture(rightHand, leftHand, spine, true, true); Assert.AreEqual(expected, actual); rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1.049f, 1.2f, 0); leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1, 0); actual = target.IdentifyZoomGesture(rightHand, leftHand, spine, true, true); expected = false; Assert.AreEqual(expected, actual); }
public void ShouldNotIdentiftZoomIntIfHandsAreNotGripped() { ZoomGripGesture target = new ZoomGripGesture(); bool expected = false; bool actual; var rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 1, 0); var leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1, 0); var spine = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 0.5f, 0); actual = target.IdentifyZoomGesture(rightHand, leftHand, spine, false, false); Assert.AreEqual(expected, actual); actual = target.IdentifyZoomGesture(rightHand, leftHand, spine, false, false); Assert.AreEqual(expected, actual); rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.9f, 1, 0); leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.1f, 1, 0); actual = target.IdentifyZoomGesture(rightHand, leftHand, spine, true, true); Assert.AreEqual(expected, actual); }