@@ -33,7 +33,9 @@ test('Get a bitmap of a specific size.', function(t)
33
33
var size = 10 ;
34
34
t . plan ( 2 ) ;
35
35
var img = robot . screen . capture ( 0 , 0 , size , size ) ;
36
-
36
+
37
+ // Support for higher density screens.
38
+ if ( img . width == ( size * 2 ) ) size = img . width ;
37
39
t . equals ( img . height , size , 'make sure image is expected height.' ) ;
38
40
t . equals ( img . width , size , 'make sure image is expected width.' ) ;
39
41
} ) ;
@@ -47,25 +49,30 @@ test('Get a bitmap and make sure the colorAt works as expected.', function(t)
47
49
t . ok ( / ^ [ 0 - 9 A - F ] { 6 } $ / i. test ( hex ) , "colorAt returned valid hex." ) ;
48
50
49
51
var screenSize = robot . getScreenSize ( ) ;
50
-
52
+ var width = screenSize . width ;
53
+ var height = screenSize . height ;
54
+
55
+ // Support for higher density screens.
56
+ if ( img . width === ( width * 2 ) ) width = img . width ; height = img . height ;
57
+
51
58
t . throws ( function ( )
52
59
{
53
- img . colorAt ( 0 , screenSize . height ) ;
60
+ img . colorAt ( 0 , height ) ;
54
61
} , / a r e o u t s i d e t h e b i t m a p / , 'colorAt (0, screen.height) threw an error.' ) ;
55
62
56
63
t . doesNotThrow ( function ( )
57
64
{
58
- img . colorAt ( 0 , screenSize . height - 1 ) ;
65
+ img . colorAt ( 0 , height - 1 ) ;
59
66
} , / a r e o u t s i d e t h e b i t m a p / , 'colorAt (0, screen.height-1) did not throw an error.' ) ;
60
67
61
68
t . throws ( function ( )
62
69
{
63
- img . colorAt ( screenSize . width , 0 ) ;
70
+ img . colorAt ( width , 0 ) ;
64
71
} , / a r e o u t s i d e t h e b i t m a p / , 'colorAt (screen.width, 0) threw an error.' ) ;
65
72
66
73
t . doesNotThrow ( function ( )
67
74
{
68
- img . colorAt ( screenSize . width - 1 , 0 ) ;
75
+ img . colorAt ( width - 1 , 0 ) ;
69
76
} , / a r e o u t s i d e t h e b i t m a p / , 'colorAt (screen.width-1, 0) did not throw an error.' ) ;
70
77
71
78
t . throws ( function ( )
0 commit comments