Skip to content

Commit

Permalink
Re-instated BasicRender and DagChanges unit tests. (#203)
Browse files Browse the repository at this point in the history
* Re-instated BasicRender and DagChanges unit tests.

* Attempt fix for macOS image comparison failure.
  • Loading branch information
ppt-adsk authored Nov 18, 2024
1 parent c2f4764 commit 8db08d7
Show file tree
Hide file tree
Showing 40 changed files with 162 additions and 88 deletions.
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.
4 changes: 2 additions & 2 deletions test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ set(INTERACTIVE_TEST_SCRIPT_FILES
testImageDiffing.py
testMtohCommand.py
# Fail as of 22-Feb-2023. Entered as MAYA-127898.
# testMtohBasicRender.py
# testMtohDagChanges.py
testBasicRender.py
testDagChanges.py
testMeshes.py
testNamespaces.py
testVisibility.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.
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.
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.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
import fixturesUtils
import mtohUtils

class TestSnapshot(mtohUtils.MayaHydraBaseTestCase):
from string import digits

class BasicRenderBaseTestCase(mtohUtils.MayaHydraBaseTestCase):

IMAGE_DIFF_FAIL_THRESHOLD = 0.01
IMAGE_DIFF_FAIL_PERCENT = 0.2

class TestSnapshot(BasicRenderBaseTestCase):
"""Tests whether our snapshot rendering works with basic Viewport 2.0"""

_file = __file__
Expand Down Expand Up @@ -49,22 +56,27 @@ def test_flat_orange(self):
cmds.setAttr('persp.rotate', 0, 0, 0, type='float3')
cmds.setAttr('persp.translate', 0, .25, .7, type='float3')

self.assertSnapshotEqual("flat_orange.png")
self.assertRaises(AssertionError,
self.assertSnapshotEqual, "flat_orange_bad.png")
self.assertSnapshotClose(
"flat_orange.png", self.IMAGE_DIFF_FAIL_THRESHOLD,
self.IMAGE_DIFF_FAIL_PERCENT)
self.assertRaises(
AssertionError, self.assertSnapshotClose, "flat_orange_bad.png",
self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)

class TestMayaHydraRender(mtohUtils.MayaHydraBaseTestCase):
class TestMayaHydraRender(BasicRenderBaseTestCase):
_file = __file__

def test_cube(self):
imageVersion = None
if maya.mel.eval("defaultShaderName") != "standardSurface1":
imageVersion = 'lambertDefaultMaterial'
imageVersion = maya.mel.eval("defaultShaderName").rstrip(digits)

self.makeCubeScene(camDist=6)
self.assertSnapshotEqual("cube_unselected.png", imageVersion)
self.assertSnapshotClose(
"cube_unselected.png", self.IMAGE_DIFF_FAIL_THRESHOLD,
self.IMAGE_DIFF_FAIL_PERCENT, imageVersion)
cmds.select(self.cubeTrans)
self.assertSnapshotEqual("cube_selected.png", imageVersion)
self.assertSnapshotClose(
"cube_selected.png", self.IMAGE_DIFF_FAIL_THRESHOLD,
self.IMAGE_DIFF_FAIL_PERCENT, imageVersion)


if __name__ == '__main__':
Expand Down
Loading

0 comments on commit 8db08d7

Please sign in to comment.