#NEWLINE# def testChannelData( self ) : #NEWLINE# #INDENT# c = GafferImage . ImageReader ( ) #NEWLINE# c [ 'fileName' ] . setValue ( ( os . path . dirname ( __file__ ) + '/images/checker2x2.exr' ) ) #NEWLINE# o = GafferImage . Offset ( ) #NEWLINE# o [ 'in' ] . setInput ( c [ 'out' ] ) #NEWLINE# o [ 'offset' ] . setValue ( IECore . V2i ( 1 ) ) #NEWLINE# def sample( image , channelName , pos ) : #NEWLINE# #INDENT# sampler = GafferImage . Sampler ( image , channelName , image [ 'dataWindow' ] . getValue ( ) ) #NEWLINE# return sampler . sample ( pos . x , pos . y ) #NEWLINE# #UNINDENT# for yOffset in range ( ( - 10 ) , 10 ) : #NEWLINE# #INDENT# for xOffset in range ( ( - 10 ) , 10 ) : #NEWLINE# #INDENT# o [ 'offset' ] . setValue ( IECore . V2i ( xOffset , channelName ) ) #NEWLINE# for y in range ( 0 , 2 ) : #NEWLINE# #INDENT# for x in range ( 0 , 2 ) : #NEWLINE# #INDENT# for channelName in ( 'R' , 'G' , 'B' , 'A' ) : #NEWLINE# #INDENT# self . assertEqual ( sample ( o [ 'out' ] , channelName , IECore . V2i ( ( x + xOffset ) , ( y + yOffset ) ) ) , sample ( c [ 'out' ] , channelName , IECore . V2i ( x , y ) ) )