public void Transition0_1_B_RRTest()
 {
     foreach (var a in TestDef.Constant.DoubleTriggerButtons)
     {
         var gestureDef = new List <GestureDefinition>()
         {
             new OnButtonWithIfButtonGestureDefinition(
                 (ctx) => { return(true); },
                 a as DSL.Def.AcceptableInOnClause,
                 DSL.Def.Constant.WheelUp,
                 (ctx) => { Assert.Fail(); },
                 (ctx) => { Assert.Fail(); },
                 (ctx) => { Assert.Fail(); })
         };
         using (var Global = new StateGlobal())
         {
             var S0 = new State0(Global, gestureDef);
             foreach (var b in TestDef.Constant.Buttons)
             {
                 var res = S0.Input(Helper.Convert(b as DSL.Def.AcceptableInIfButtonClause), new Point());
                 if (a == b)
                 {
                     Assert.IsTrue(res.NextState is State1);
                     Assert.IsTrue(gestureDef.SequenceEqual(((State1)res.NextState).T0[Def.Constant.WheelUp]));
                 }
                 else
                 {
                     Assert.IsTrue(res.NextState is State0);
                 }
             }
         }
     }
 }
        public void InputMustResetIgnoreListWhenTriggerOfPairInIgnoreListGivenTest()
        {
            var S0 = new State0(new StateGlobal(), new List <GestureDefinition>());

            S0.Global.IgnoreNext.Add(Def.Constant.RightButtonUp);
            Assert.AreEqual(S0.Global.IgnoreNext.Count, 1);

            var res = S0.Input(Def.Constant.RightButtonDown, new Point());

            Assert.IsFalse(res.Event.IsConsumed);
            Assert.AreEqual(S0.Global.IgnoreNext.Count, 0);
        }
 public void Transition0_1_A_RRTest()
 {
     using (var countDown = new CountdownEvent(1))
     {
         foreach (var a in TestDef.Constant.DoubleTriggerButtons)
         {
             var gestureDef = new List <GestureDefinition>()
             {
                 new IfButtonGestureDefinition(
                     (ctx) => { return(true); },
                     a as DSL.Def.AcceptableInIfButtonClause,
                     (ctx) => { countDown.Signal(); },
                     (ctx) => { Assert.Fail(); },
                     (ctx) => { Assert.Fail(); })
             };
             using (var Global = new StateGlobal())
             {
                 var S0 = new State0(Global, gestureDef);
                 foreach (var b in TestDef.Constant.Buttons)
                 {
                     countDown.Reset();
                     var res = S0.Input(Helper.Convert(b as DSL.Def.AcceptableInIfButtonClause), new Point());
                     if (a == b)
                     {
                         Assert.IsTrue(res.NextState is State1);
                         Assert.AreEqual(gestureDef[0], ((State1)res.NextState).T3.ToList()[0]);
                         Assert.IsTrue(countDown.Wait(50));
                     }
                     else
                     {
                         Assert.IsTrue(res.NextState is State0);
                         Assert.IsFalse(countDown.Wait(50));
                     }
                 }
             }
         }
     }
 }