Skip to content

Commit

Permalink
add test for cover display & seleciton for object template
Browse files Browse the repository at this point in the history
  • Loading branch information
lilike-adsk committed Feb 21, 2024
1 parent a42668e commit 4b6a739
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 56 deletions.
2 changes: 1 addition & 1 deletion test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set(INTERACTIVE_TEST_SCRIPT_FILES
testUSDLights.py
testArnoldLights.py
testLookThrough.py
testTemplateAndReference.py
testObjectTemplate.py
testStandardSurface.py
testFlowViewportAPI.py
testStageVariants.py
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import mayaUtils
import platform

class TestTemplateAndReference(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose
class TestObjectTemplate(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose
# MayaHydraBaseTestCase.setUpClass requirement.
_file = __file__

Expand All @@ -36,42 +36,30 @@ def imageDiffFailPercent(self):
return 3
return 0.2

#Test object display & selection under Template & Reference modes.
def test_TemplateAndReference(self):
#Test object display & selection when template attribute is on.
def test_ObjectTemplate(self):
cmds.file(new=True, force=True)

# Load a maya scene with a maya native cubic and sphere
# Load a maya scene with a maya native sphere
testFile = mayaUtils.openTestScene(
"testTemplateAndReference",
"testTemplateAndReference.ma")
"testObjectTemplate",
"testObjectTemplate.ma")
cmds.refresh()

#Verify Default display
panel = mayaUtils.activeModelPanel()
self.assertSnapshotClose("default" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

#Verify template mode
#Verify template attribute
#Display
cmds.setAttr('layer_sphere.displayType', 1)
cmds.setAttr('pSphere1.template', 1)
cmds.refresh()
self.assertSnapshotClose("templateMode" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent)
self.assertSnapshotClose("templateOn" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent)
#Selection
cmds.select( clear=True )
cmds.select( 'pSphere1', r=True )
cmds.refresh()
self.assertSnapshotClose("templateModeSelection" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

#Verify reference mode
#Display
cmds.setAttr('layer_cubic.displayType', 2)
cmds.refresh()
self.assertSnapshotClose("referenceMode" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent)
#Selection
cmds.select( clear=True )
cmds.select( 'pCube1', r=True )
cmds.refresh()
self.assertSnapshotClose("referenceModeSelection" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

self.assertSnapshotClose("templateOnSelection" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent)

if __name__ == '__main__':
fixturesUtils.runTests(globals())

Large diffs are not rendered by default.

0 comments on commit 4b6a739

Please sign in to comment.