#NEWLINE# def testAddIdleCallbackFromIdleCallback( self ) : #NEWLINE# #INDENT# self . __runOnceCalls = 0 #NEWLINE# self . __addRunOnceCalls = 0 #NEWLINE# def runOnce( ) : #NEWLINE# #INDENT# self . __runOnceCalls += 1 #NEWLINE# return False #NEWLINE# #UNINDENT# def addRunOnce( ) : #NEWLINE# #INDENT# self . __addRunOnceCalls += 1 #NEWLINE# if ( self . __addRunOnceCalls == 2 ) : #NEWLINE# #INDENT# GafferUI . EventLoop . mainEventLoop ( ) . stop ( ) #NEWLINE# return False #NEWLINE# #UNINDENT# GafferUI . EventLoop . mainEventLoop ( ) . addIdleCallback ( runOnce ) #NEWLINE# return True #NEWLINE# #UNINDENT# GafferUI . EventLoop . addIdleCallback ( runOnce ) #NEWLINE# GafferUI . EventLoop . addIdleCallback ( addRunOnce ) #NEWLINE# GafferUI . EventLoop . mainEventLoop ( ) . start ( ) #NEWLINE# self . assertEqual ( self . __runOnceCalls , 2 ) #NEWLINE# self . assertEqual ( self . __addRunOnceCalls , 2 )