Files
o3de/AutomatedTesting/Gem/PythonTests/WhiteBox/tests/WhiteBox_AddComponentToEntity.py
T
chiyenteng 7c6c01d5a1 Convert automated tests related to content and unused levels (#7416)
* Convert automated tests related to content/WaterSample level/Physics's Base level

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Fix nits

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Add missing .prefab level file

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Fix nits

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Convert Blast tests

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Convert scripting tests

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Remove useless comments

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Revert Collider_AddColliderComponent change until prefab error message bug fixed

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>
2022-02-07 12:11:01 -08:00

56 lines
1.8 KiB
Python

"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test case ID : C28798177
# Test Case Title : White Box Tool Component can be added to an Entity
# fmt:off
class Tests():
white_box_entity_created = ("White box entity created", "Failed to create white box entity")
white_box_component_enabled = ("White box component enabled", "Failed to enable white box component")
# fmt:on
def C28798177_WhiteBox_AddComponentToEntity():
import os
import sys
from Gems.WhiteBox.Editor.Scripts import WhiteBoxInit as init
import azlmbr.bus as bus
import azlmbr.editor as editor
import azlmbr.legacy.general as general
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import TestHelper as helper
# open level
helper.init_idle()
helper.open_level("WhiteBox", "EmptyLevel", no_prompt=False)
# create white box entity and attach component
white_box_entity = init.create_white_box_entity()
white_box_mesh_component = init.create_white_box_component(white_box_entity)
init.create_white_box_handle(white_box_mesh_component)
# verify results
entity_id = general.find_editor_entity('WhiteBox')
Report.result(Tests.white_box_entity_created, entity_id.IsValid())
component_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', white_box_mesh_component)
Report.result(Tests.white_box_component_enabled, component_enabled)
# close editor
helper.close_editor()
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(C28798177_WhiteBox_AddComponentToEntity)