#NEWLINE# def testDispatcherSignals( self ) : #NEWLINE# #INDENT# class CapturingSlot2 ( list ) : #NEWLINE# #INDENT# def __init__( self , * signals ) : #NEWLINE# #INDENT# self . __connections = [ ] #NEWLINE# for s in signals : #NEWLINE# #INDENT# self . __connections . append ( s . connect ( Gaffer . WeakMethod ( self . __slot ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# def __slot( self , d , nodes ) : #NEWLINE# #INDENT# self . append ( ( d , nodes ) ) #NEWLINE# #UNINDENT# #UNINDENT# preCs = CapturingSlot2 ( GafferDispatch . Dispatcher . preDispatchSignal ( ) ) #NEWLINE# self . assertEqual ( len ( preCs ) , 0 ) #NEWLINE# postCs = GafferTest . CapturingSlot ( GafferDispatch . Dispatcher . postDispatchSignal ( ) ) #NEWLINE# self . assertEqual ( len ( postCs ) , 0 ) #NEWLINE# s = Gaffer . ScriptNode ( ) #NEWLINE# s [ 'n1' ] = GafferDispatchTest . LoggingExecutableNode ( ) #NEWLINE# dispatcher = GafferDispatch . Dispatcher . create ( 'testDispatcher' ) #NEWLINE# dispatcher . dispatch ( [ s [ 'n1' ] ] ) #NEWLINE# self . assertEqual ( len ( preCs ) , 1 ) #NEWLINE# self . failUnless ( preCs [ 0 ] [ 0 ] . isSame ( dispatcher ) ) #NEWLINE# self . assertEqual ( preCs [ 0 ] [ 1 ] , [ s [ 'n1' ] ] ) #NEWLINE# self . assertEqual ( len ( postCs ) , 1 ) #NEWLINE# self . failUnless ( postCs [ 0 ] [ 0 ] . isSame ( dispatcher ) ) #NEWLINE# self . assertEqual ( postCs [ 0 ] [ 1 ] , [ s [ 'n1' ] ] )