You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/AutomatedTesting/Gem/PythonTests/WhiteBox/C28798177_WhiteBox_AddCompo...

61 lines
1.9 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 ImportPathHelper as imports
imports.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()
general.open_level("EmptyLevel")
# 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__":
import ImportPathHelper as imports
imports.init()
from editor_python_test_tools.utils import Report
Report.start_test(C28798177_WhiteBox_AddComponentToEntity)