public void GivenRightHandStartAboveLeftWhenItGoBelowLeftThenRightRotationIsIdentifiedAndStateShouldStayAsExecutedTest() { RotationGripGesture target = new RotationGripGesture(); bool expected = false; bool actual; var rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 1.2f, 0); var leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1, 0); var spine = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 0.5f, 0); actual = target.IdentifyRotationGesture(rightHand, leftHand, spine, false, false); Assert.AreEqual(expected, actual); //Closed hands actual = target.IdentifyRotationGesture(rightHand, leftHand, spine, true, true); Assert.AreEqual(expected, actual); rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 1f, 0); leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1.2f, 0); actual = target.IdentifyRotationGesture(rightHand, leftHand, spine, true, true); expected = true; Assert.AreEqual(expected, actual); Assert.AreEqual(GestureEvents.ROTATE_RIGHT, target.Name); Assert.AreEqual(2, target.State); rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 0.95f, 0); leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1.25f, 0); actual = target.IdentifyRotationGesture(rightHand, leftHand, spine, true, true); expected = false; Assert.AreEqual(expected, actual); Assert.AreEqual(2, target.State); }
public void ShouldNotIdentifyRotationIfLeftHandIsNotGripped() { RotationGripGesture target = new RotationGripGesture(); bool expected = false; bool actual; var rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 1f, 0); var leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1.2f, 0); var spine = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 0.5f, 0); actual = target.IdentifyRotationGesture(rightHand, leftHand, spine, false, false); Assert.AreEqual(expected, actual); //Closed hands actual = target.IdentifyRotationGesture(rightHand, leftHand, spine, true, true); Assert.AreEqual(expected, actual); rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 1.2f, 0); leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1f, 0); actual = target.IdentifyRotationGesture(rightHand, leftHand, spine, false, true); Assert.AreEqual(expected, actual); }
public void GivenRightHandIsAboveLeftWhenAngleChangeMoreThan60DegreesToLeftThenLeftRotationIsIdentified() { RotationGripGesture target = new RotationGripGesture(); bool expected = false; bool actual; var rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1.5f, 1.2f, 0); var leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 1f, 0); var spine = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 0.5f, 0); actual = target.IdentifyRotationGesture(rightHand, leftHand, spine, false, false); Assert.AreEqual(expected, actual); //Closed hands actual = target.IdentifyRotationGesture(rightHand, leftHand, spine, true, true); Assert.AreEqual(expected, actual); rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 1.2f, 0); actual = target.IdentifyRotationGesture(rightHand, leftHand, spine, true, true); expected = true; Assert.AreEqual(expected, actual); Assert.AreEqual(GestureEvents.ROTATE_LEFT, target.Name); }