-
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
HYDRA-807 : Add Unit Test for Maya Display Modes #74
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
efa1d87
Add Unit Test for Maya Display Modes
roopavr-adsk 2eefda6
Update reference images
roopavr-adsk e255e26
minor updates
roopavr-adsk 0152da6
remove tmp files and update code comment
roopavr-adsk c0149c1
minor comment changes
roopavr-adsk 6bf3c04
increase threshold for osx tests
roopavr-adsk 03f2e6d
increased osx threshold
roopavr-adsk 4dbff86
increased threshold further
roopavr-adsk 59c3615
fixed a errorneous typo
roopavr-adsk 65041be
update reference image for osx failure
roopavr-adsk 15ef617
Revert "update reference image for osx failure"
debloip-adsk 631b71d
HYDRA-807 : Add OSX-specific per-pixel threshold and adjust image-wid…
debloip-adsk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+4.88 KB
test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/allLights.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.88 KB
test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/defaultMaterial.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+76.6 KB
test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/displayTextures.png
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 added
BIN
+4.42 KB
test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/smoothShaded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.04 KB
test/lib/mayaUsd/render/mayaToHydra/MayaDisplayModesTest/wireframeOnShaded.png
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.
102 changes: 102 additions & 0 deletions
102
test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayModes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# | ||
# Copyright 2024 Autodesk, Inc. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import maya.cmds as cmds | ||
import fixturesUtils | ||
import mtohUtils | ||
import mayaUtils | ||
|
||
import platform | ||
|
||
class TestMayaDisplayModes(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose | ||
# MayaHydraBaseTestCase.setUpClass requirement. | ||
_file = __file__ | ||
|
||
@property | ||
def imageDiffFailThreshold(self): | ||
# HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds | ||
# for that platform specifically for now, so we can still catch issues on other platforms. | ||
if platform.system() == "Darwin": | ||
return 0.1 | ||
return 0.01 | ||
|
||
@property | ||
def imageDiffFailPercent(self): | ||
# HYDRA-837 : Wireframes seem to have a slightly different color on macOS. We'll increase the thresholds | ||
# for that platform specifically for now, so we can still catch issues on other platforms. | ||
if platform.system() == "Darwin": | ||
return 4 | ||
return 0.2 | ||
|
||
def switchDisplayModes(self): | ||
panel = mayaUtils.activeModelPanel() | ||
|
||
cmds.modelEditor(panel, edit=True, wireframeOnShaded=False) | ||
|
||
#Use Default Material | ||
cmds.modelEditor(panel, edit=True, useDefaultMaterial=True) | ||
cmds.refresh() | ||
self.assertSnapshotClose("defaultMaterial" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#WireframeOnShaded mode | ||
cmds.modelEditor(panel, edit=True, wireframeOnShaded=True) | ||
cmds.refresh() | ||
self.assertSnapshotClose("wireframeOnShaded" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
cmds.modelEditor(panel, edit=True, wireframeOnShaded=False) | ||
|
||
#Shadows mode | ||
cmds.modelEditor(panel, edit=True, shadows=True) | ||
cmds.refresh() | ||
self.assertSnapshotClose("shadows" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
cmds.modelEditor(panel, edit=True, shadows=False) | ||
|
||
#All Lights mode | ||
cmds.modelEditor(panel, edit=True, displayLights="all") | ||
cmds.refresh() | ||
self.assertSnapshotClose("allLights" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#xray mode | ||
cmds.modelEditor(panel, edit=True, xray=True) | ||
cmds.refresh() | ||
self.assertSnapshotClose("xray" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
cmds.modelEditor(panel, edit=True, xray=False) | ||
|
||
#Display texures mode | ||
cmds.modelEditor(panel, edit=True, useDefaultMaterial=False) | ||
cmds.modelEditor(panel, edit=True, displayTextures=True) | ||
cmds.refresh() | ||
self.assertSnapshotClose("displayTextures" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
cmds.modelEditor(panel, edit=True, displayTextures=False) | ||
|
||
#Smoothshaded Material | ||
cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded") | ||
cmds.refresh() | ||
self.assertSnapshotClose("smoothShaded" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
|
||
def test_MayaDisplayModes(self): | ||
cmds.file(new=True, force=True) | ||
|
||
# open simple Maya scene | ||
testFile = mayaUtils.openTestScene( | ||
"testMayaDisplayModes", | ||
"testMayaDisplayModes.ma") | ||
cmds.refresh() | ||
|
||
self.switchDisplayModes() | ||
|
||
if __name__ == '__main__': | ||
fixturesUtils.runTests(globals()) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
394 changes: 394 additions & 0 deletions
394
test/testSamples/testMayaDisplayModes/testMayaDisplayModes.ma
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just noticed this, but as an FYI, this is no longer necessary, as that command will now be run by default before each individual test (see mtohUtils.py). Shouldn't cause issues though.
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.
noted. will incorporate it in my next PR.