Updated Light, Grid, and Physical Sky P0 tests

Signed-off-by: Neil Widmaier <nwidmaie@amazon.com>
This commit is contained in:
Neil Widmaier
2022-01-28 12:19:27 -08:00
parent 56e7e70735
commit f1ad9ef0b8
4 changed files with 73 additions and 36 deletions
@@ -27,6 +27,9 @@ class Tests:
light_component = (
"Entity has a Light component",
"Entity failed to find Light component")
light_type_value = (
"Light type value set",
"Light type value could not be set")
enter_game_mode = (
"Entered game mode",
"Failed to enter game mode")
@@ -68,13 +71,14 @@ def AtomEditorComponents_Light_AddedToEntity():
2) Add Light component to the Light entity.
3) UNDO the entity creation and component addition.
4) REDO the entity creation and component addition.
5) Enter/Exit game mode.
6) Test IsHidden.
7) Test IsVisible.
8) Delete Light entity.
9) UNDO deletion.
10) REDO deletion.
11) Look for errors.
5) Set the light type to sphere.
6) Enter/Exit game mode.
7) Test IsHidden.
8) Test IsVisible.
9) Delete Light entity.
10) UNDO deletion.
11) REDO deletion.
12) Look for errors.
:return: None
"""
@@ -83,7 +87,7 @@ def AtomEditorComponents_Light_AddedToEntity():
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import Report, Tracer, TestHelper
from Atom.atom_utils.atom_constants import AtomComponentProperties
from Atom.atom_utils.atom_constants import AtomComponentProperties, LIGHT_TYPES
with Tracer() as error_tracer:
# Test setup begins.
@@ -124,35 +128,42 @@ def AtomEditorComponents_Light_AddedToEntity():
general.idle_wait_frames(1)
Report.result(Tests.creation_redo, light_entity.exists())
# 5. Enter/Exit game mode.
# 5. Set the light type to sphere
light_component.set_component_property_value(
AtomComponentProperties.light('Light type'), LIGHT_TYPES['sphere'])
current_light_type = light_component.get_component_property_value(
AtomComponentProperties.light('Light type'))
Report.result(Tests.light_type_value, current_light_type == LIGHT_TYPES['sphere'])
# 6. Enter/Exit game mode.
TestHelper.enter_game_mode(Tests.enter_game_mode)
general.idle_wait_frames(1)
TestHelper.exit_game_mode(Tests.exit_game_mode)
# 6. Test IsHidden.
# 7. Test IsHidden.
light_entity.set_visibility_state(False)
Report.result(Tests.is_hidden, light_entity.is_hidden() is True)
# 7. Test IsVisible.
# 8. Test IsVisible.
light_entity.set_visibility_state(True)
general.idle_wait_frames(1)
Report.result(Tests.is_visible, light_entity.is_visible() is True)
# 8. Delete Light entity.
# 9. Delete Light entity.
light_entity.delete()
Report.result(Tests.entity_deleted, not light_entity.exists())
# 9. UNDO deletion.
# 10. UNDO deletion.
general.undo()
general.idle_wait_frames(1)
Report.result(Tests.deletion_undo, light_entity.exists())
# 10. REDO deletion.
# 11. REDO deletion.
general.redo()
general.idle_wait_frames(1)
Report.result(Tests.deletion_redo, not light_entity.exists())
# 11. Look for errors asserts.
# 12. Look for errors asserts.
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
for error_info in error_tracer.errors:
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")