Files
o3de/AutomatedTesting/Gem/PythonTests/prefab/Prefab_BasicWorkflow_InstantiatePrefab.py
T
chiyenteng f7d4d80e5b 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>
2021-09-03 14:06:22 -05:00

35 lines
1.1 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
"""
def Prefab_BasicWorkflow_InstantiatePrefab():
from azlmbr.math import Vector3
EXISTING_TEST_PREFAB_FILE_NAME = "Test"
INSTANTIATED_TEST_PREFAB_POSITION = Vector3(10.00, 20.0, 30.0)
EXPECTED_TEST_PREFAB_CHILDREN_COUNT = 1
from prefab.Prefab import Prefab
import prefab.Prefab_Test_Utils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
# Checks for prefab instantiation passed or not
test_prefab = Prefab.get_prefab(EXISTING_TEST_PREFAB_FILE_NAME)
instantiated_test_container_entity_id = test_prefab.instantiate(
prefab_position=INSTANTIATED_TEST_PREFAB_POSITION)
prefab_test_utils.check_entity_children_count(
instantiated_test_container_entity_id,
EXPECTED_TEST_PREFAB_CHILDREN_COUNT)
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(Prefab_BasicWorkflow_InstantiatePrefab)