Beispiel #1
0
        public void TestClicks()
        {
            Cursor.Vector = new System.Windows.Vector(0, 0);
            Click click = new Click(
                new IntTuple(546, 22), new IntTuple(234, 4), ButtonType.MIDDLE, MovementType.SPRING,
                new IntTuple(789, 43), new IntTuple(34, 342), new DoubleTuple(4.2, 3.9),
                true, true, true);

            AutoClickerParser parser = SetUp(click.ToString());

            AutoClickerParser.InstructionsContext context = parser.instructions();
            AutoClickerVisitor visitor = new AutoClickerVisitor();
            Click parsed = (Click)((List <AutoClicker.Instructions.Instruction>)visitor.Visit(context))[0];

            Assert.Equal(click, parsed);
        }
        public void ParseTest()
        {
            string input = testClick.ToString() + "\n";

            input += testHover.ToString() + "\n";
            input += testDrag.ToString() + "\n";
            input += testKeystroke.ToString() + "\n";

            AutoClickerParser parser = SetUp(input.ToString());

            AutoClickerParser.InstructionsContext context = parser.instructions();
            AutoClickerVisitor visitor = new AutoClickerVisitor();
            List <Instructions.Instruction> instructions = (List <Instructions.Instruction>)visitor.Visit(context);

            Assert.IsTrue(instructions.Contains(testClick));
            Assert.IsTrue(instructions.Contains(testHover));
            Assert.IsTrue(instructions.Contains(testDrag));
            Assert.IsTrue(instructions.Contains(testKeystroke));
        }