示例#1
0
 public void Simple_swipe_left() {
     var detected = true;
     var b = new Gesture();
     b.AddStep(50000, Movement.Left(_cam.LeftHand, 10));
     b.GestureDetected += (s, a) => {
         detected = true;
     };
     b.Activate();
     Assert.IsTrue(detected);
 }
示例#2
0
        public void Should_go_to_next_step() {
            var step = 0;
            var b = new Gesture();
            b.AddStep(50000, Movement.Forward(_cam.LeftHand, 10), Movement.Forward(_cam.RightHand, 10));
            b.AddStep(50000, Movement.Left(_cam.LeftHand, 10), Movement.Right(_cam.RightHand, 10));
            b.NextStep += (s,a) => {
                step = a.Step;
            };
            b.Activate();

            _cam.MoveLeftHandZ(30);
            _cam.MoveLeftHandZ(20);
            _cam.MoveRightHandZ(30);
            _cam.MoveRightHandZ(20);

            Assert.AreEqual(1, step);
        }
示例#3
0
        public void Should_notify_gesture() {
            var detected = true;
            var b = new Gesture();
            b.AddStep(50000, Movement.Forward(_cam.LeftHand, 10), Movement.Forward(_cam.RightHand, 10));
            b.AddStep(50000, Movement.Left(_cam.LeftHand, 10), Movement.Right(_cam.RightHand, 10));
            b.GestureDetected += (s, a) => {
                detected = true;
            };
            b.Activate();

            _cam.MoveLeftHandZ(30);
            _cam.MoveLeftHandZ(20);
            _cam.MoveRightHandZ(30);
            _cam.MoveRightHandZ(20);

            _cam.MoveLeftHandX(30);
            _cam.MoveLeftHandX(20);
            _cam.MoveRightHandX(20);
            _cam.MoveRightHandX(30);

            Assert.IsTrue(detected);
        }