Skip to content

Commit

Permalink
SetAlgo : Add tests for set expressions containing tabs and newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
murraystevenson committed Jul 30, 2024
1 parent fd2595f commit 9879d81
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/GafferSceneTest/SetAlgoTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ def test( self ) :
expressionCheck( '(setA - ((setC /group/group/sphere2) & setB))', [ '/group/group/sphere1' ] )
expressionCheck( 'setA - (/group/group/sphere1 /group/group/sphere2) | (setA setB setC) & setC', [ '/group/sphere3' ] )

# Test a selection of the above expressions with tab and newline whitespace characters inserted
expressionCheck( 'setA\nsetC', [ '/group/group/sphere1', '/group/group/sphere2', '/group/sphere3' ] )
expressionCheck( '\n\nsetA\tsetC\n\n\t', [ '/group/group/sphere1', '/group/group/sphere2', '/group/sphere3' ] )
expressionCheck( 'setA\t-\tsetB\n|\nsetC', [ '/group/group/sphere1', '/group/sphere3' ] )
expressionCheck( 'setA\n| setB\n& setC', [ '/group/group/sphere1', '/group/group/sphere2' ] )
expressionCheck( '/group/light1\n/group/light2', [ '/group/light1', '/group/light2' ] )
expressionCheck( '/group/light1\t/group/light2\n', [ '/group/light1', '/group/light2' ] )
expressionCheck( '(\n\t/group/light1\n\t/group/light2\n)\n|\nsetA', [ '/group/light1', '/group/light2', '/group/group/sphere1', '/group/group/sphere2' ] )
expressionCheck( '(\nsetA - \n(\n\t(\n\t\tsetC /group/group/sphere2\n\t)\n & setB)\n)\n', [ '/group/group/sphere1' ] )

# Test expressions containing only whitespace are treated as empty
expressionCheck( '', [] )
expressionCheck( ' ', [] )
Expand Down

0 comments on commit 9879d81

Please sign in to comment.