-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Unit Test for Maya Shading Modes (#77)
* Add Unit Test for Maya Shading Modes
- Loading branch information
1 parent
9afcbc4
commit 6fe3600
Showing
12 changed files
with
410 additions
and
13 deletions.
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
+3.51 KB
test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/backfaceCulling.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.08 KB
test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/boundingBox.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
+3.28 KB
test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/flatShaded.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.37 KB
test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/jointxray.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
+8.53 KB
test/lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/smoothwireframe.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
+8.14 KB
...lib/mayaUsd/render/mayaToHydra/MayaShadingModesTest/smoothwireframeonshaded.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.
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
106 changes: 106 additions & 0 deletions
106
test/lib/mayaUsd/render/mayaToHydra/testMayaShadingModes.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,106 @@ | ||
# | ||
# 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 TestMayaShadingModes(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.05 | ||
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 5 | ||
return 0.2 | ||
|
||
def test_MayaShadingModes(self): | ||
|
||
testFile = mayaUtils.openTestScene( | ||
"testMayaShadingModes", | ||
"testMayaShadingModes.ma") | ||
|
||
cmds.refresh() | ||
|
||
panel = mayaUtils.activeModelPanel() | ||
|
||
cmds.modelEditor(panel, edit=True, wireframeOnShaded=False) | ||
#Smooth Shading | ||
cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded") | ||
cmds.refresh() | ||
self.assertSnapshotClose("default" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
#Flat Shading | ||
cmds.modelEditor(panel, edit=True, displayAppearance="flatShaded") | ||
cmds.refresh() | ||
self.assertSnapshotClose("flatShaded" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded") | ||
|
||
#Bounding Box | ||
cmds.modelEditor(panel, edit=True, displayAppearance="boundingBox") | ||
cmds.refresh() | ||
self.assertSnapshotClose("boundingBox" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded") | ||
|
||
#SmoothWirefame | ||
cmds.modelEditor(panel, edit=True, displayAppearance="wireframe") | ||
cmds.modelEditor(panel, edit=True, smoothWireframe=True) | ||
cmds.refresh() | ||
self.assertSnapshotClose("smoothwireframe" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
cmds.modelEditor(panel, edit=True, smoothWireframe=False) | ||
cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded") | ||
|
||
#SmoothWirefameOnShaded | ||
cmds.modelEditor(panel, edit=True, wireframeOnShaded=True) | ||
cmds.modelEditor(panel, edit=True, smoothWireframe=True) | ||
cmds.refresh() | ||
self.assertSnapshotClose("smoothwireframeonshaded" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
cmds.modelEditor(panel, edit=True, smoothWireframe=False) | ||
cmds.modelEditor(panel, edit=True, wireframeOnShaded=False) | ||
|
||
#X-ray | ||
cmds.modelEditor(panel, edit=True, xray=True) | ||
cmds.refresh() | ||
self.assertSnapshotClose("xray" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
cmds.modelEditor(panel, edit=True, xray=False) | ||
|
||
#joint xray mode | ||
cmds.modelEditor(panel, edit=True, jointXray=True) | ||
cmds.refresh() | ||
self.assertSnapshotClose("jointxray" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
cmds.modelEditor(panel, edit=True, jointXray=False) | ||
|
||
#backfaceCulling | ||
cmds.modelEditor(panel, edit=True, backfaceCulling=True) | ||
cmds.refresh() | ||
self.assertSnapshotClose("backfaceCulling" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) | ||
|
||
if __name__ == '__main__': | ||
fixturesUtils.runTests(globals()) |
Oops, something went wrong.