Skip to content

Commit af11693

Browse files
committed
Added unit test.
1 parent 5d4f9df commit af11693

File tree

4 files changed

+345
-0
lines changed

4 files changed

+345
-0
lines changed

test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ set(INTERACTIVE_TEST_SCRIPT_FILES
6060
testSceneModified.py
6161
testStageInstanceablePrimsSelHighlight.py|skipOnPlatform:osx # HYDRA-1315 : Wire not showing on OSX
6262
testIsolateSelectWithGeomSubset.py
63+
testIsolateSelectWithUsdLighting.py
6364
cpp/testColorPreferences.py
6465
cpp/testCppFramework.py
6566
cpp/testDataProducerExample.py
12.3 KB
Loading
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright 2024 Autodesk
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
import maya.cmds as cmds
16+
import maya.mel as mel
17+
import fixturesUtils
18+
import mayaUtils
19+
import mtohUtils
20+
21+
def enableIsolateSelect(modelPanel):
22+
# See comments in cpp/testIsolateSelect.py
23+
cmds.setFocus(modelPanel)
24+
mel.eval("enableIsolateSelect %s 1" % modelPanel)
25+
26+
def disableIsolateSelect(modelPanel):
27+
cmds.setFocus(modelPanel)
28+
mel.eval("enableIsolateSelect %s 0" % modelPanel)
29+
30+
class TestIsolateSelectWithUsdLighting(mtohUtils.MayaHydraBaseTestCase):
31+
# MayaHydraBaseTestCase.setUpClass requirement.
32+
_file = __file__
33+
34+
IMAGE_DIFF_FAIL_THRESHOLD = 0.01
35+
IMAGE_DIFF_FAIL_PERCENT = 0.2
36+
37+
def test_IsolateSelectWithUsdLighting(self):
38+
mayaUtils.openTestScene(
39+
"testIsolateSelectWithUsdLighting",
40+
"mayaPlusUSDMeshesWithUSDLighting.ma")
41+
42+
# Bring the camera in closer.
43+
self.setBasicCam(5)
44+
45+
cmds.refresh()
46+
47+
# Isolate select the USD sphere.
48+
modelPanel = 'modelPanel4'
49+
enableIsolateSelect(modelPanel)
50+
51+
cmds.select('|stage1|stageShape1,/pSphere1')
52+
cmds.editor(modelPanel, edit=True, updateMainConnection=True)
53+
cmds.isolateSelect(modelPanel, loadSelected=True)
54+
55+
cmds.refresh()
56+
57+
self.assertSnapshotClose("isolateSelectWithUsdLighting" + ".png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)
58+
59+
# Disable the isolate selection.
60+
disableIsolateSelect(modelPanel)
61+
62+
cmds.refresh()
63+
64+
if __name__ == '__main__':
65+
fixturesUtils.runTests(globals())

0 commit comments

Comments
 (0)