#NEWLINE# def assertImagesEqual( self , imageA , imageB , maxDifference = 0.0 , ignoreMetadata = False , ignoreDataWindow = False ) : #NEWLINE# #INDENT# self . assertEqual ( imageA [ 'format' ] . getValue ( ) , imageB [ 'format' ] . getValue ( ) ) #NEWLINE# if ( not ignoreDataWindow ) : #NEWLINE# #INDENT# self . assertEqual ( imageA [ 'dataWindow' ] . getValue ( ) , imageB [ 'dataWindow' ] . getValue ( ) ) #NEWLINE# #UNINDENT# if ( not imageA ) : #NEWLINE# #INDENT# self . assertEqual ( imageA [ 'metadata' ] . getValue ( ) , imageB [ 'metadata' ] . getValue ( ) ) #NEWLINE# #UNINDENT# self . assertEqual ( imageA [ 'channelNames' ] . getValue ( ) , imageB [ 'channelNames' ] . getValue ( ) ) #NEWLINE# for channelName in imageA [ 'channelNames' ] . getValue ( ) : #NEWLINE# #INDENT# self . assertTrue ( ( channelName in 'RGBA' ) ) #NEWLINE# #UNINDENT# difference = GafferImage . Merge ( ) #NEWLINE# difference [ 'in' ] [ 0 ] . setInput ( imageA ) #NEWLINE# difference [ 'in' ] [ 1 ] . setInput ( imageB ) #NEWLINE# difference [ 'operation' ] . setValue ( GafferImage . Merge . Operation . Difference ) #NEWLINE# stats = GafferImage . ImageStats ( ) #NEWLINE# stats [ 'in' ] . setInput ( difference [ 'out' ] ) #NEWLINE# stats [ 'regionOfInterest' ] . setValue ( imageA [ 'format' ] . getValue ( ) . getDisplayWindow ( ) ) #NEWLINE# stats [ 'channels' ] . setValue ( IECore . StringVectorData ( [ 'R' , 'G' , 'B' , 'A' ] ) ) #NEWLINE# if ( 'R' in imageA [ 'channelNames' ] . getValue ( ) ) : #NEWLINE# #INDENT# self . assertLessEqual ( stats [ 'max' ] [ 'r' ] . getValue ( ) , maxDifference ) #NEWLINE# #UNINDENT# if ( 'G' in imageA [ 'channelNames' ] . getValue ( ) ) : #NEWLINE# #INDENT# self . assertLessEqual ( stats [ 'max' ] [ 'g' ] . getValue ( ) , maxDifference ) #NEWLINE# #UNINDENT# if ( 'B' in imageA [ 'channelNames' ] . getValue ( ) ) : #NEWLINE# #INDENT# self . assertLessEqual ( stats [ 'max' ] [ 'b' ] . getValue ( ) , maxDifference ) #NEWLINE# #UNINDENT# if ( 'A' in imageA [ 'channelNames' ] . getValue ( ) ) : #NEWLINE# #INDENT# self . assertLessEqual ( stats [ 'max' ] [ 'a' ] . getValue ( ) , maxDifference )