Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for getPixelColor and getScreenSize.
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var test = require('tape'); | ||
var robot = require('..'); | ||
var pixelColor, screenSize; | ||
|
||
test('Get pixel color.', function(t) | ||
{ | ||
t.plan(4); | ||
t.ok(pixelColor = robot.getPixelColor(5, 5), 'successfully got pixel color.'); | ||
t.ok(pixelColor !== undefined, 'pixelColor is a valid value.'); | ||
t.ok(pixelColor.length === 6, 'pixelColor is the correct length.'); | ||
t.ok(/^[0-9A-F]{6}$/i.test(pixelColor), "pixelColor is valid hex."); | ||
}); | ||
|
||
test('Get screen size.', function(t) | ||
{ | ||
t.plan(3); | ||
t.ok(screenSize = robot.getScreenSize(), 'successfully got the screen size.'); | ||
t.ok(screenSize.width !== undefined, 'screenSize.width is a valid value.'); | ||
t.ok(screenSize.height !== undefined, 'screenSize.height is a valid value.'); | ||
}); |