1#!/pxrpythonsubst
2#
3# Copyright 2017 Pixar
4#
5# Licensed under the Apache License, Version 2.0 (the "Apache License")
6# with the following modification; you may not use this file except in
7# compliance with the Apache License and the following modification to it:
8# Section 6. Trademarks. is deleted and replaced with:
9#
10# 6. Trademarks. This License does not grant permission to use the trade
11#    names, trademarks, service marks, or product names of the Licensor
12#    and its affiliates, except as required to comply with Section 4(c) of
13#    the License and to reproduce the content of the NOTICE file.
14#
15# You may obtain a copy of the Apache License at
16#
17#     http://www.apache.org/licenses/LICENSE-2.0
18#
19# Unless required by applicable law or agreed to in writing, software
20# distributed under the Apache License with the above modification is
21# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22# KIND, either express or implied. See the Apache License for the specific
23# language governing permissions and limitations under the Apache License.
24#
25
26# Remove any unwanted visuals from the view.
27def _modifySettings(appController):
28    appController._dataModel.viewSettings.showBBoxes = False
29    appController._dataModel.viewSettings.showHUD = False
30
31# Set the background color and refresh the view.
32def _setBackgroundColorAction(appController, action):
33    action.setChecked(True)
34    appController._changeBgColor(action)
35    appController._stageView.updateGL()
36
37# Test with a black background color.
38def _testBlackBackground(appController):
39    _setBackgroundColorAction(appController, appController._ui.actionBlack)
40    appController._takeShot("black.png")
41
42# Test with a dark grey background color.
43def _testGreyDarkBackground(appController):
44    _setBackgroundColorAction(appController, appController._ui.actionGrey_Dark)
45    appController._takeShot("grey_dark.png")
46
47# Test with a light grey background color.
48def _testGreyLightBackground(appController):
49    _setBackgroundColorAction(appController, appController._ui.actionGrey_Light)
50    appController._takeShot("grey_light.png")
51
52# Test with a white background color.
53def _testWhiteBackground(appController):
54    _setBackgroundColorAction(appController, appController._ui.actionWhite)
55    appController._takeShot("white.png")
56
57# Test that the background color setting works properly in usdview.
58def testUsdviewInputFunction(appController):
59    _modifySettings(appController)
60    _testBlackBackground(appController)
61    _testGreyDarkBackground(appController)
62    _testGreyLightBackground(appController)
63    _testWhiteBackground(appController)
64