Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-instated BasicRender and DagChanges unit tests. #203

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core change in this pull request :)

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(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed from assertSnapshotEqual to assertSnapshotClose everywhere.

"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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected image files are now in a subdirectory based on the default shader name stripped of its numerical suffix, e.g. lambert, standardSurface, openPBRSurface.


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