/pxr/usdImaging/bin/testusdview/testenv/testUsdviewMetadatatabSelect/testUsdviewMetadatatabSelect.py

https://github.com/PixarAnimationStudios/USD · Python · 86 lines · 44 code · 15 blank · 27 comment · 0 complexity · 228e511edf2d6656b17bb6d95842664d MD5 · raw file

  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. def _testSelectionChangeScrollPosition(appController):
  25. # A test to ensure changing the selection in the metadata
  26. # tab view does not affect the current scroll position in
  27. # the property view
  28. propView = appController._ui.propertyView
  29. inspectorView = appController._ui.propertyInspector
  30. initialScroll = propView.verticalScrollBar().value()
  31. inspectorView.setCurrentIndex(2)
  32. appController._mainWindow.repaint()
  33. assert propView.verticalScrollBar().value() == initialScroll
  34. inspectorView.setCurrentIndex(3)
  35. appController._mainWindow.repaint()
  36. assert propView.verticalScrollBar().value() == initialScroll
  37. inspectorView.setCurrentIndex(2)
  38. appController._mainWindow.repaint()
  39. assert propView.verticalScrollBar().value() == initialScroll
  40. inspectorView.setCurrentIndex(1)
  41. appController._mainWindow.repaint()
  42. assert propView.verticalScrollBar().value() == initialScroll
  43. inspectorView.setCurrentIndex(0)
  44. appController._mainWindow.repaint()
  45. assert propView.verticalScrollBar().value() == initialScroll
  46. def _testBasic(appController):
  47. inspectorView = appController._ui.propertyInspector
  48. inspectorView.setCurrentIndex(0)
  49. appController._mainWindow.repaint()
  50. assert inspectorView.tabText(inspectorView.currentIndex()) == 'Value'
  51. inspectorView.setCurrentIndex(1)
  52. appController._mainWindow.repaint()
  53. assert inspectorView.tabText(inspectorView.currentIndex()) == 'Meta Data'
  54. inspectorView.setCurrentIndex(2)
  55. appController._mainWindow.repaint()
  56. assert inspectorView.tabText(inspectorView.currentIndex()) == 'Layer Stack'
  57. inspectorView.setCurrentIndex(3)
  58. appController._mainWindow.repaint()
  59. assert inspectorView.tabText(inspectorView.currentIndex()) == 'Composition'
  60. def testUsdviewInputFunction(appController):
  61. # select our initial elements(prim and property).
  62. appController._ui.primViewLineEdit.setText('Implicits')
  63. appController._primViewFindNext()
  64. appController._mainWindow.repaint()
  65. appController._ui.attrViewLineEdit.setText('z')
  66. appController._attrViewFindNext()
  67. appController._ui.attrViewLineEdit.setText('y')
  68. appController._attrViewFindNext()
  69. appController._mainWindow.repaint()
  70. _testBasic(appController)
  71. _testSelectionChangeScrollPosition(appController)