#NEWLINE# @ patch ( 'glue.core.Sprite.hash' ) #NEWLINE# def test_retina_cachebuster( self , mocked_hash ) : #NEWLINE# #INDENT# mocked_hash . __get__ = Mock ( return_value = '12345' ) #NEWLINE# self . create_image ( 'simple/red.png' , RED ) #NEWLINE# self . create_image ( 'simple/blue.png' , BLUE ) #NEWLINE# code = self . call ( 'glue simple output --retina --cachebuster' ) #NEWLINE# self . assertEqual ( mocked_hash , 0 ) #NEWLINE# self . assertExists ( 'output/simple.png' ) #NEWLINE# self . assertExists ( 'output/simple@2x.png' ) #NEWLINE# self . assertExists ( 'output/simple.css' ) #NEWLINE# self . assertColor ( 'output/simple.png' , RED , ( ( 0 , 0 ) , ( 31 , 31 ) ) , 0.1 ) #NEWLINE# self . assertColor ( 'output/simple.png' , BLUE , ( ( 31 , 0 ) , ( 63 , 31 ) ) , 0.1 ) #NEWLINE# self . assertColor ( 'output/simple@2x.png' , RED , ( ( 0 , 0 ) , ( 63 , 63 ) ) ) #NEWLINE# self . assertColor ( 'output/simple@2x.png' , BLUE , ( ( 64 , 0 ) , ( 127 , 63 ) ) ) #NEWLINE# self . assertCSS ( 'output/simple.css' , '.sprite-simple-red' , { #NEWLINE# #INDENT# 'background-image' : 'url(simple.png?12345)' , #NEWLINE# 'background-repeat' : 'no-repeat' , #NEWLINE# 'background-position' : '0 0' , #NEWLINE# 'width' : '32px' , #NEWLINE# 'height' : '32px' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertCSS ( 'output/simple.css' , '.sprite-simple-blue' , { #NEWLINE# #INDENT# 'background-image' : 'url(simple.png?12345)' , #NEWLINE# 'background-repeat' : 'no-repeat' , #NEWLINE# 'background-position' : '-32px 0' , #NEWLINE# 'width' : '32px' , #NEWLINE# 'height' : '32px' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertCSS ( 'output/simple.css' , '.sprite-simple-red' , { #NEWLINE# #INDENT# 'background-image' : 'url(simple@2x.png?12345)' , #NEWLINE# 'background-repeat' : 'no-repeat' , #NEWLINE# 'background-position' : '0 0' , #NEWLINE# 'background-size' : '64px 32px' , #NEWLINE# '-webkit-background-size' : '64px 32px' , #NEWLINE# '-moz-background-size' : '64px 32px' , #NEWLINE# 'width' : '32px' , #NEWLINE# 'height' : '32px' , #NEWLINE# #UNINDENT# } , ratio = 2 ) #NEWLINE# self . assertCSS ( 'output/simple.css' , '.sprite-simple-blue' , { #NEWLINE# #INDENT# 'background-image' : 'url(simple@2x.png?12345)' , #NEWLINE# 'background-repeat' : 'no-repeat' , #NEWLINE# 'background-position' : '-32px 0' , #NEWLINE# 'background-size' : '64px 32px' , #NEWLINE# '-webkit-background-size' : '64px 32px' , #NEWLINE# '-moz-background-size' : '64px 32px' , #NEWLINE# 'width' : '32px' , #NEWLINE# 'height' : '32px' , #NEWLINE# #UNINDENT# } , ratio = 2 )