@@ -4,11 +4,31 @@ var pixelColor, screenSize;
4
4
5
5
test ( 'Get pixel color.' , function ( t )
6
6
{
7
- t . plan ( 4 ) ;
7
+ t . plan ( 8 ) ;
8
8
t . ok ( pixelColor = robot . getPixelColor ( 5 , 5 ) , 'successfully got pixel color.' ) ;
9
9
t . ok ( pixelColor !== undefined , 'pixelColor is a valid value.' ) ;
10
10
t . ok ( pixelColor . length === 6 , 'pixelColor is the correct length.' ) ;
11
11
t . ok ( / ^ [ 0 - 9 A - F ] { 6 } $ / i. test ( pixelColor ) , "pixelColor is valid hex." ) ;
12
+
13
+ t . throws ( function ( )
14
+ {
15
+ robot . getPixelColor ( 9999999999999 , 9999999999999 ) ;
16
+ } , / o u t s i d e t h e m a i n s c r e e n / , 'get color of pixel (9999999999999, 9999999999999).' ) ;
17
+
18
+ t . throws ( function ( )
19
+ {
20
+ robot . getPixelColor ( - 1 , - 1 ) ;
21
+ } , / o u t s i d e t h e m a i n s c r e e n / , 'get color of pixel (-1, -1).' ) ;
22
+
23
+ t . throws ( function ( )
24
+ {
25
+ robot . getPixelColor ( 0 ) ;
26
+ } , / I n v a l i d n u m b e r / , 'get color of pixel (0).' ) ;
27
+
28
+ t . throws ( function ( )
29
+ {
30
+ robot . getPixelColor ( 1 , 2 , 3 ) ;
31
+ } , / I n v a l i d n u m b e r / , 'get color of pixel (1, 2, 3).' ) ;
12
32
} ) ;
13
33
14
34
test ( 'Get screen size.' , function ( t )
0 commit comments