Skip to content

Commit 790c3c6

Browse files
committed
Tests for getPixelColor and getScreenSize.
1 parent 1208cf8 commit 790c3c6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/screen.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var test = require('tape');
2+
var robot = require('..');
3+
var pixelColor, screenSize;
4+
5+
test('Get pixel color.', function(t)
6+
{
7+
t.plan(4);
8+
t.ok(pixelColor = robot.getPixelColor(5, 5), 'successfully got pixel color.');
9+
t.ok(pixelColor !== undefined, 'pixelColor is a valid value.');
10+
t.ok(pixelColor.length === 6, 'pixelColor is the correct length.');
11+
t.ok(/^[0-9A-F]{6}$/i.test(pixelColor), "pixelColor is valid hex.");
12+
});
13+
14+
test('Get screen size.', function(t)
15+
{
16+
t.plan(3);
17+
t.ok(screenSize = robot.getScreenSize(), 'successfully got the screen size.');
18+
t.ok(screenSize.width !== undefined, 'screenSize.width is a valid value.');
19+
t.ok(screenSize.height !== undefined, 'screenSize.height is a valid value.');
20+
});

0 commit comments

Comments
 (0)