diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testDataProducerExample.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testDataProducerExample.py index 89cd19200..6543720b5 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testDataProducerExample.py +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testDataProducerExample.py @@ -58,6 +58,9 @@ def cube000PathString(self): def cube222PathString(self): return '|transform1|' + self._locator + ',/cube_2_2_2' + def cubePrototypePathString(self): + return '|transform1|' + self._locator + ',/cube_' + def test_Pick(self): # Pick an exterior cube to ensure we don't pick a hidden one. cmds.mayaHydraCppTest(self.cube222PathString(), f='TestUsdPicking.pick') @@ -132,5 +135,27 @@ def assertTranslationAlmostEqual(expected): cmds.redo() assertTranslationAlmostEqual([3, 4, 5]) + def test_SelectPrototype(self): + # Enable instancing + cmds.setAttr(self._locator + '.cubesUseInstancing', True) + + # Clear selection + sn = ufe.GlobalSelection.get() + sn.clear() + + # Empty Maya selection, therefore no fully selected path in the scene + # index. + cmds.mayaHydraCppTest(f='TestSelection.fullySelectedPaths') + + # Add cube to selection + item = ufe.Hierarchy.createItem(ufe.PathString.path(self.cubePrototypePathString())) + sn.append(item) + + # Item added to the Maya selection, it should be fully selected in the + # scene index. + cmds.mayaHydraCppTest( + self.cubePrototypePathString(), f='TestSelection.fullySelectedPaths') + + if __name__ == '__main__': fixturesUtils.runTests(globals())