Esempio n. 1
0
        public void IdentifyGestureTest()
        {
            JoinHandsGesture target = new JoinHandsGesture();

            //Hands together
            var rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 1f, 0f);
            var leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 1f, 0f);
            var spine = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 0.5f, 0.5f);
            bool isRightHandGripped = false;
            bool isLeftHandGripped = false;
            IJoint rightShoulder = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1f, 0.5f);
            IJoint leftShoulder = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1f, 0.5f);
            bool expected = false;
            bool actual;
            actual = target.IdentifyGesture(rightHand, leftHand, isRightHandGripped, isLeftHandGripped, spine, rightShoulder, leftShoulder);
            Assert.AreEqual(expected, actual);

            //Open hands
            rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 1f, 0f);
            leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1f, 0f);
            actual = target.IdentifyGesture(rightHand, leftHand, isRightHandGripped, isLeftHandGripped, spine, rightShoulder, leftShoulder);
            Assert.AreEqual(expected, actual);
            
            //Join hands
            rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 1f, 0f);
            leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 1f, 0f);
            actual = target.IdentifyGesture(rightHand, leftHand, isRightHandGripped, isLeftHandGripped, spine, rightShoulder, leftShoulder);
            expected = true;
            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void ShouldIdentifyGestureIfHandsOpenOnMiddleOfJoinMovement()
        {
            JoinHandsGesture target = new JoinHandsGesture();

            //Hands together
            var rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 1f, 0f);
            var leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 1f, 0f);
            var spine = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 0.5f, 0.04f);
            bool isRightHandGripped = false;
            bool isLeftHandGripped = false;
            IJoint rightShoulder = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1f, 0.04f);
            IJoint leftShoulder = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1f, 0.04f);
            bool expected = false;
            bool actual;
            actual = target.IdentifyGesture(rightHand, leftHand, isRightHandGripped, isLeftHandGripped, spine, rightShoulder, leftShoulder);
            Assert.AreEqual(expected, actual);

            //Open hands
            rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(1f, 1f, 0f);
            leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0f, 1f, 0f);
            actual = target.IdentifyGesture(rightHand, leftHand, isRightHandGripped, isLeftHandGripped, spine, rightShoulder, leftShoulder);
            Assert.AreEqual(expected, actual);

            //middle of movement with hands closed 
            rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.7f, 1f, 0f);
            leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.3f, 1f, 0f);
            actual = target.IdentifyGesture(rightHand, leftHand, true, true, spine, rightShoulder, leftShoulder);
            Assert.AreEqual(expected, actual);

            //Join hands
            rightHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 1f, 0f);
            leftHand = CommonTest.CreateDummyJointWithSkeletonPoint(0.5f, 1f, 0f);
            actual = target.IdentifyGesture(rightHand, leftHand, isRightHandGripped, isLeftHandGripped, spine, rightShoulder, leftShoulder);
            Assert.AreEqual(expected, actual);
        }