-
Notifications
You must be signed in to change notification settings - Fork 4
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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__ | ||
|
@@ -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( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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__': | ||
|
There was a problem hiding this comment.
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 :)