Skip to content

Commit

Permalink
LightEditorTest : Fix testing w/ multiple columns
Browse files Browse the repository at this point in the history
- Getting any old `_GafferSceneUI._LightEditorInspectorColumn` will also
include the new `_GafferSceneUI._LightEditorSoloColumn`, which we don't
want.
- It turns out creating a Python list with multiple entries using the
`[] * n` syntax creates shallow copies of the list contents. Therefore
when modifying the selection, it was affecting all columns because the
list members were all the same `IECore.PathMatcher()`. This caused
incorrect results when both the "Mute" and "Solo" column were toggled.
  • Loading branch information
ericmehl committed Jan 27, 2023
1 parent 70d9722 commit c8590be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/GafferSceneUITest/LightEditorTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,12 +637,12 @@ def testLightMuteAttribute( toggleCount, toggleLocation, newStates ) :

if muteIndex is None :
for i, c in zip( range( 0, len( columns ) ), columns ) :
if isinstance( c, _GafferSceneUI._LightEditorInspectorColumn ) :
if isinstance( c, _GafferSceneUI._LightEditorMuteColumn ) :
muteIndex = i

self.assertIsNotNone( muteIndex )

selection = [IECore.PathMatcher()] * len( columns )
selection = [ IECore.PathMatcher() for i in range( 0, len( columns ) ) ]
for path in togglePaths :
selection[muteIndex].addPath( path )

Expand Down

0 comments on commit c8590be

Please sign in to comment.