#NEWLINE# def testUndo( self ) : #NEWLINE# #INDENT# s = Gaffer . ScriptNode ( ) #NEWLINE# s [ 'n1' ] = GafferTest . AddNode ( ) #NEWLINE# s [ 'n2' ] = GafferTest . AddNode ( ) #NEWLINE# s [ 'd' ] = Gaffer . Dot ( ) #NEWLINE# self . assertTrue ( ( 'in' not in s [ 'd' ] ) ) #NEWLINE# self . assertTrue ( ( 'out' not in s [ 'd' ] ) ) #NEWLINE# with Gaffer . UndoContext ( s ) : #NEWLINE# #INDENT# s [ 'd' ] . setup ( s [ 'n2' ] [ 'op1' ] ) #NEWLINE# s [ 'd' ] [ 'in' ] . setInput ( s [ 'n1' ] [ 'sum' ] ) #NEWLINE# s [ 'n2' ] [ 'op1' ] . setInput ( s [ 'd' ] [ 'out' ] ) #NEWLINE# #UNINDENT# self . assertTrue ( s [ 'n2' ] [ 'op1' ] . source ( ) . isSame ( s [ 'n1' ] [ 'sum' ] ) ) #NEWLINE# s . undo ( ) #NEWLINE# self . assertTrue ( ( 'in' not in s [ 'd' ] ) ) #NEWLINE# self . assertTrue ( ( 'out' not in s [ 'd' ] ) ) #NEWLINE# s . redo ( ) #NEWLINE# self . assertTrue ( s [ 'n2' ] [ 'op1' ] . source ( ) . isSame ( s [ 'n1' ] [ 'sum' ] ) )