Skip to content

Commit

Permalink
Tests for moveMouseSmooth.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Jan 8, 2016
1 parent 2e221ba commit ad7e5dc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ test('Move the mouse.', function(t)

t.ok(robot.moveMouse("0", "0") === 1, 'move mouse to ("0", "0").');

});

test('Move the mouse smoothly.', function(t)
{
t.plan(6);
lastKnownPos = robot.moveMouseSmooth(0, 0);
t.ok(robot.moveMouseSmooth(100, 100) === 1, 'successfully moved the mouse.');
currentPos = robot.getMousePos();
t.ok(currentPos.x === 100, 'mousepos.x is correct.');
t.ok(currentPos.y === 100, 'mousepos.y is correct.');

t.throws(function()
{
robot.moveMouseSmooth(0, 1, 2, 3);
}, /Invalid number/, 'move mouse to (0, 1, 2, 3).');

t.throws(function()
{
robot.moveMouseSmooth(0);
}, /Invalid number/, 'move mouse to (0).');

t.ok(robot.moveMouseSmooth("0", "0") === 1, 'move mouse to ("0", "0").');

});
});

Expand Down

0 comments on commit ad7e5dc

Please sign in to comment.