Skip to content

Commit ad7e5dc

Browse files
committed
Tests for moveMouseSmooth.
1 parent 2e221ba commit ad7e5dc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/mouse.js

+23
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,29 @@ test('Move the mouse.', function(t)
3434

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

37+
});
38+
39+
test('Move the mouse smoothly.', function(t)
40+
{
41+
t.plan(6);
42+
lastKnownPos = robot.moveMouseSmooth(0, 0);
43+
t.ok(robot.moveMouseSmooth(100, 100) === 1, 'successfully moved the mouse.');
44+
currentPos = robot.getMousePos();
45+
t.ok(currentPos.x === 100, 'mousepos.x is correct.');
46+
t.ok(currentPos.y === 100, 'mousepos.y is correct.');
47+
48+
t.throws(function()
49+
{
50+
robot.moveMouseSmooth(0, 1, 2, 3);
51+
}, /Invalid number/, 'move mouse to (0, 1, 2, 3).');
52+
53+
t.throws(function()
54+
{
55+
robot.moveMouseSmooth(0);
56+
}, /Invalid number/, 'move mouse to (0).');
57+
58+
t.ok(robot.moveMouseSmooth("0", "0") === 1, 'move mouse to ("0", "0").');
59+
3760
});
3861
});
3962

0 commit comments

Comments
 (0)