#NEWLINE# def testFilters( self ) : #NEWLINE# #INDENT# p = Gaffer . Path ( '/' ) #NEWLINE# self . assertEqual ( p . getFilter ( ) , None ) #NEWLINE# changedPaths = [ ] #NEWLINE# def f( path ) : #NEWLINE# #INDENT# changedPaths . append ( str ( path ) ) #NEWLINE# #UNINDENT# c = p . pathChangedSignal ( ) . connect ( filter ) #NEWLINE# self . assertEqual ( len ( changedPaths ) , 0 ) #NEWLINE# filter = Gaffer . FileNamePathFilter ( [ '*.gfr' ] ) #NEWLINE# p . setFilter ( filter ) #NEWLINE# self . failUnless ( p . getFilter ( ) . isSame ( filter ) ) #NEWLINE# self . assertEqual ( len ( changedPaths ) , 1 ) #NEWLINE# p . setFilter ( filter ) #NEWLINE# self . failUnless ( p . getFilter ( ) . isSame ( filter ) ) #NEWLINE# self . assertEqual ( len ( changedPaths ) , 1 ) #NEWLINE# p . setFilter ( None ) #NEWLINE# self . failUnless ( ( p . getFilter ( ) is None ) ) #NEWLINE# self . assertEqual ( len ( changedPaths ) , 2 ) #NEWLINE# p . setFilter ( filter ) #NEWLINE# self . failUnless ( p . getFilter ( ) . isSame ( filter ) ) #NEWLINE# self . assertEqual ( len ( changedPaths ) , 3 ) #NEWLINE# filter . setEnabled ( False ) #NEWLINE# self . assertEqual ( len ( changedPaths ) , 4 ) #NEWLINE# filter . setEnabled ( True ) #NEWLINE# self . assertEqual ( len ( changedPaths ) , 5 )