WhiteBox_AddComponentToEntity.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 : C28798177
  7. # Test Case Title : White Box Tool Component can be added to an Entity
  8. # fmt:off
  9. class Tests():
  10. white_box_entity_created = ("White box entity created", "Failed to create white box entity")
  11. white_box_component_enabled = ("White box component enabled", "Failed to enable white box component")
  12. # fmt:on
  13. def C28798177_WhiteBox_AddComponentToEntity():
  14. import editor_python_test_tools.hydra_editor_utils as hydra
  15. import azlmbr.bus as bus
  16. import azlmbr.editor as editor
  17. import azlmbr.legacy.general as general
  18. import WhiteBoxInit as init
  19. from editor_python_test_tools.utils import Report
  20. # open level
  21. hydra.open_base_level()
  22. # create white box entity and attach component
  23. white_box_entity = init.create_white_box_entity()
  24. white_box_mesh_component = init.create_white_box_component(white_box_entity)
  25. init.create_white_box_handle(white_box_mesh_component)
  26. # verify results
  27. entity_id = general.find_editor_entity('WhiteBox')
  28. Report.result(Tests.white_box_entity_created, entity_id.IsValid())
  29. component_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', white_box_mesh_component)
  30. Report.result(Tests.white_box_component_enabled, component_enabled)
  31. if __name__ == "__main__":
  32. from editor_python_test_tools.utils import Report
  33. Report.start_test(C28798177_WhiteBox_AddComponentToEntity)