<s> import os <EOL> import unittest <EOL> import IECore <EOL> import Gaffer <EOL> import GafferImage <EOL> import GafferImageTest <EOL> class ObjectToImageTest ( GafferImageTest . ImageTestCase ) : <EOL> fileName = os . path . expandvars ( "<STR_LIT>" ) <EOL> negFileName = os . path . expandvars ( "<STR_LIT>" ) <EOL> def test ( self ) : <EOL> i = IECore . Reader . create ( self . fileName ) . read ( ) <EOL> n = GafferImage . ObjectToImage ( ) <EOL> n [ "<STR_LIT:object>" ] . setValue ( i ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] . image ( ) , i ) <EOL> def testImageWithANegativeDataWindow ( self ) : <EOL> i = IECore . Reader . create ( self . negFileName ) . read ( ) <EOL> n = GafferImage . ObjectToImage ( ) <EOL> n [ "<STR_LIT:object>" ] . setValue ( i ) <EOL> self . assertEqual ( n [ "<STR_LIT>" ] . image ( ) , i ) <EOL> def testHashVariesPerTileAndChannel ( self ) : <EOL> n = GafferImage . ObjectToImage ( ) <EOL> n [ "<STR_LIT:object>" ] . setValue ( IECore . Reader . create ( self . fileName ) . read ( ) ) <EOL> self . assertNotEqual ( <EOL> n [ "<STR_LIT>" ] . channelDataHash ( "<STR_LIT:R>" , IECore . V2i ( <NUM_LIT:0> ) ) , <EOL> n [ "<STR_LIT>" ] . channelDataHash ( "<STR_LIT>" , IECore . V2i ( <NUM_LIT:0> ) ) <EOL> ) <EOL> self . assertNotEqual ( <EOL> n [ "<STR_LIT>" ] . channelDataHash ( "<STR_LIT:R>" , IECore . V2i ( <NUM_LIT:0> ) ) , <EOL> n [ "<STR_LIT>" ] . channelDataHash ( "<STR_LIT:R>" , IECore . V2i ( GafferImage . ImagePlug . tileSize ( ) ) ) <EOL> ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
