WhiteBox_SetInvisible.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. """
  2. Copyright (c) Contributors to the Open 3D Engine Project.
  3. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. SPDX-License-Identifier: Apache-2.0 OR MIT
  5. """
  6. # Test case ID : C28798205
  7. # Test Case Title : From the White Box Component Card the White Box Mesh can be set to be invisible in Game View
  8. # fmt:off
  9. class Tests():
  10. white_box_initially_visible = ("White box initially invisible", "White box not initially invisible")
  11. white_box_set_to_invisible = ("White box set to invisible", "Failed to set white box to invisible")
  12. # fmt:on
  13. def C28798205_WhiteBox_SetInvisible():
  14. # note: This automated test does not fully replicate the test case in Test Rail as it's
  15. # not currently possible using the Hydra API to get an EntityComponentIdPair at runtime,
  16. # in future game_mode will be activated and a runtime White Box Component queried
  17. import azlmbr.bus as bus
  18. import azlmbr.editor as editor
  19. import editor_python_test_tools.hydra_editor_utils as hydra
  20. import WhiteBoxInit as init
  21. from editor_python_test_tools.utils import Report
  22. # open level
  23. hydra.open_base_level()
  24. white_box_entity_name = 'WhiteBox-Visibility'
  25. white_box_visibility_path = 'White Box Material|Visible'
  26. # create white box entity and attach component
  27. white_box_entity = init.create_white_box_entity(white_box_entity_name)
  28. white_box_mesh_component = init.create_white_box_component(white_box_entity)
  29. # verify preconditions
  30. visible_property = hydra.get_component_property_value(white_box_mesh_component, white_box_visibility_path)
  31. Report.result(Tests.white_box_initially_visible, visible_property)
  32. # verify setting visibility
  33. editor.EditorComponentAPIBus(bus.Broadcast, "SetComponentProperty", white_box_mesh_component, white_box_visibility_path, False)
  34. visible_property = hydra.get_component_property_value(white_box_mesh_component, white_box_visibility_path)
  35. Report.result(Tests.white_box_set_to_invisible, not visible_property)
  36. if __name__ == "__main__":
  37. from editor_python_test_tools.utils import Report
  38. Report.start_test(C28798205_WhiteBox_SetInvisible)