Add prefab reparenting python auto tests (#3653)
* Add prefab reparenting python auto tests Signed-off-by: chiyteng <chiyteng@amazon.com> * modify prefab python auto test framework Signed-off-by: chiyteng <chiyteng@amazon.com> * remove extra spaces Signed-off-by: chiyteng <chiyteng@amazon.com> * delete unused files Signed-off-by: chiyteng <chiyteng@amazon.com> * delete unused files Signed-off-by: chiyteng <chiyteng@amazon.com> * fix nits Signed-off-by: chiyteng <chiyteng@amazon.com> * Refactor prefab python tests Signed-off-by: chiyteng <chiyteng@amazon.com> * Fix nits Signed-off-by: chiyteng <chiyteng@amazon.com> * Modify comments Signed-off-by: chiyteng <chiyteng@amazon.com> * Fix nits and add comments for Prefab.py Signed-off-by: chiyteng <chiyteng@amazon.com>
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
def Prefab_BasicWorkflow_CreateAndReparentPrefab():
|
||||
|
||||
CAR_PREFAB_FILE_NAME = 'car_prefab'
|
||||
WHEEL_PREFAB_FILE_NAME = 'wheel_prefab'
|
||||
|
||||
import editor_python_test_tools.pyside_utils as pyside_utils
|
||||
|
||||
@pyside_utils.wrap_async
|
||||
async def run_test():
|
||||
|
||||
from editor_python_test_tools.editor_entity_utils import EditorEntity
|
||||
from prefab.Prefab import Prefab
|
||||
|
||||
import prefab.Prefab_Test_Utils as prefab_test_utils
|
||||
|
||||
prefab_test_utils.open_base_tests_level()
|
||||
|
||||
# Creates a new Entity at the root level
|
||||
# Asserts if creation didn't succeed
|
||||
car_entity = EditorEntity.create_editor_entity()
|
||||
car_prefab_entities = [car_entity]
|
||||
|
||||
# Checks for prefab creation passed or not
|
||||
car_prefab = Prefab.create_prefab(
|
||||
car_prefab_entities, CAR_PREFAB_FILE_NAME)
|
||||
|
||||
# Creates another new Entity at the root level
|
||||
wheel_entity = EditorEntity.create_editor_entity()
|
||||
wheel_prefab_entities = [wheel_entity]
|
||||
|
||||
# Checks for wheel prefab creation passed or not
|
||||
wheel_prefab = Prefab.create_prefab(
|
||||
wheel_prefab_entities, WHEEL_PREFAB_FILE_NAME)
|
||||
|
||||
# Checks for prefab reparenting passed or not
|
||||
car = car_prefab.instances[CAR_PREFAB_FILE_NAME]
|
||||
wheel = wheel_prefab.instances[WHEEL_PREFAB_FILE_NAME]
|
||||
await wheel.ui_reparent_prefab_instance(car.container_entity.id)
|
||||
|
||||
run_test()
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Prefab_BasicWorkflow_CreateAndReparentPrefab)
|
||||
Reference in New Issue
Block a user