|
@@ -5,43 +5,59 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
|
SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
+
|
|
class Tests:
|
|
class Tests:
|
|
creation_undo = (
|
|
creation_undo = (
|
|
"UNDO Entity creation success",
|
|
"UNDO Entity creation success",
|
|
- "UNDO Entity creation failed")
|
|
|
|
|
|
+ "P0: UNDO Entity creation failed")
|
|
creation_redo = (
|
|
creation_redo = (
|
|
"REDO Entity creation success",
|
|
"REDO Entity creation success",
|
|
- "REDO Entity creation failed")
|
|
|
|
|
|
+ "P0: REDO Entity creation failed")
|
|
grid_entity_creation = (
|
|
grid_entity_creation = (
|
|
"Grid Entity successfully created",
|
|
"Grid Entity successfully created",
|
|
- "Grid Entity failed to be created")
|
|
|
|
|
|
+ "P0: Grid Entity failed to be created")
|
|
grid_component_added = (
|
|
grid_component_added = (
|
|
"Entity has a Grid component",
|
|
"Entity has a Grid component",
|
|
- "Entity failed to find Grid component")
|
|
|
|
|
|
+ "P0: Entity failed to find Grid component")
|
|
grid_size = (
|
|
grid_size = (
|
|
"Grid Size value set successfully",
|
|
"Grid Size value set successfully",
|
|
- "Grid Size value could not be set")
|
|
|
|
|
|
+ "P0: Grid Size value could not be set")
|
|
enter_game_mode = (
|
|
enter_game_mode = (
|
|
"Entered game mode",
|
|
"Entered game mode",
|
|
- "Failed to enter game mode")
|
|
|
|
|
|
+ "P0: Failed to enter game mode")
|
|
exit_game_mode = (
|
|
exit_game_mode = (
|
|
"Exited game mode",
|
|
"Exited game mode",
|
|
- "Couldn't exit game mode")
|
|
|
|
|
|
+ "P0: Couldn't exit game mode")
|
|
is_visible = (
|
|
is_visible = (
|
|
"Entity is visible",
|
|
"Entity is visible",
|
|
- "Entity was not visible")
|
|
|
|
|
|
+ "P0: Entity was not visible")
|
|
is_hidden = (
|
|
is_hidden = (
|
|
"Entity is hidden",
|
|
"Entity is hidden",
|
|
- "Entity was not hidden")
|
|
|
|
|
|
+ "P0: Entity was not hidden")
|
|
entity_deleted = (
|
|
entity_deleted = (
|
|
"Entity deleted",
|
|
"Entity deleted",
|
|
- "Entity was not deleted")
|
|
|
|
|
|
+ "P0: Entity was not deleted")
|
|
deletion_undo = (
|
|
deletion_undo = (
|
|
"UNDO deletion success",
|
|
"UNDO deletion success",
|
|
- "UNDO deletion failed")
|
|
|
|
|
|
+ "P0: UNDO deletion failed")
|
|
deletion_redo = (
|
|
deletion_redo = (
|
|
"REDO deletion success",
|
|
"REDO deletion success",
|
|
- "REDO deletion failed")
|
|
|
|
|
|
+ "P0: REDO deletion failed")
|
|
|
|
+ axis_color = (
|
|
|
|
+ "Axis Color value set successfully",
|
|
|
|
+ "P1: Axis Color value could not be set")
|
|
|
|
+ primary_grid_spacing = (
|
|
|
|
+ "Primary Grid Spacing value set successfully",
|
|
|
|
+ "P1: Primary Grid Spacing value could not be set")
|
|
|
|
+ primary_color = (
|
|
|
|
+ "Primary Color value set successfully",
|
|
|
|
+ "P1: Primary Color value could not be set")
|
|
|
|
+ secondary_grid_spacing = (
|
|
|
|
+ "Secondary Grid Spacing value set successfully",
|
|
|
|
+ "P1: Secondary Grid Spacing value could not be set")
|
|
|
|
+ secondary_color = (
|
|
|
|
+ "Secondary Color value set successfully",
|
|
|
|
+ "P1: Secondary Color value could not be set")
|
|
|
|
|
|
|
|
|
|
def AtomEditorComponents_Grid_AddedToEntity():
|
|
def AtomEditorComponents_Grid_AddedToEntity():
|
|
@@ -51,10 +67,11 @@ def AtomEditorComponents_Grid_AddedToEntity():
|
|
|
|
|
|
Test setup:
|
|
Test setup:
|
|
- Wait for Editor idle loop.
|
|
- Wait for Editor idle loop.
|
|
- - Open the "Base" level.
|
|
|
|
|
|
+ - Open the "base_empty" level.
|
|
|
|
|
|
Expected Behavior:
|
|
Expected Behavior:
|
|
The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
|
|
The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
|
|
|
|
+ Property values for the component can be set.
|
|
Creation and deletion undo/redo should also work.
|
|
Creation and deletion undo/redo should also work.
|
|
|
|
|
|
Test Steps:
|
|
Test Steps:
|
|
@@ -62,21 +79,25 @@ def AtomEditorComponents_Grid_AddedToEntity():
|
|
2) Add a Grid component to Grid entity.
|
|
2) Add a Grid component to Grid entity.
|
|
3) UNDO the entity creation and component addition.
|
|
3) UNDO the entity creation and component addition.
|
|
4) REDO the entity creation and component addition.
|
|
4) REDO the entity creation and component addition.
|
|
- 5) Grid Size changed.
|
|
|
|
- 6) Enter/Exit game mode.
|
|
|
|
- 7) Test IsHidden.
|
|
|
|
- 8) Test IsVisible.
|
|
|
|
- 9) Delete Grid entity.
|
|
|
|
- 10) UNDO deletion.
|
|
|
|
- 11) REDO deletion.
|
|
|
|
- 12) Look for errors.
|
|
|
|
|
|
+ 5) Grid Size property value updated.
|
|
|
|
+ 6) Axis Color property value updated.
|
|
|
|
+ 7) Primary Grid Spacing property value updated.
|
|
|
|
+ 8) Primary Color property value updated.
|
|
|
|
+ 9) Secondary Grid Spacing property value updated.
|
|
|
|
+ 10) Secondary Color property value updated.
|
|
|
|
+ 11) Enter/Exit game mode.
|
|
|
|
+ 12) Test IsHidden.
|
|
|
|
+ 13) Test IsVisible.
|
|
|
|
+ 14) Delete Grid entity.
|
|
|
|
+ 15) UNDO deletion.
|
|
|
|
+ 16) REDO deletion.
|
|
|
|
+ 17) Look for errors.
|
|
|
|
|
|
:return: None
|
|
:return: None
|
|
"""
|
|
"""
|
|
|
|
|
|
- import os
|
|
|
|
-
|
|
|
|
import azlmbr.legacy.general as general
|
|
import azlmbr.legacy.general as general
|
|
|
|
+ import azlmbr.math as math
|
|
|
|
|
|
from editor_python_test_tools.editor_entity_utils import EditorEntity
|
|
from editor_python_test_tools.editor_entity_utils import EditorEntity
|
|
from editor_python_test_tools.utils import Report, Tracer, TestHelper
|
|
from editor_python_test_tools.utils import Report, Tracer, TestHelper
|
|
@@ -123,42 +144,79 @@ def AtomEditorComponents_Grid_AddedToEntity():
|
|
general.idle_wait_frames(1)
|
|
general.idle_wait_frames(1)
|
|
Report.result(Tests.creation_redo, grid_entity.exists())
|
|
Report.result(Tests.creation_redo, grid_entity.exists())
|
|
|
|
|
|
- # 5. Grid Size changed
|
|
|
|
|
|
+ # 5. Grid Size property value updated.
|
|
grid_component.set_component_property_value(
|
|
grid_component.set_component_property_value(
|
|
AtomComponentProperties.grid('Grid Size'), value=64)
|
|
AtomComponentProperties.grid('Grid Size'), value=64)
|
|
current_grid_size = grid_component.get_component_property_value(
|
|
current_grid_size = grid_component.get_component_property_value(
|
|
AtomComponentProperties.grid('Grid Size'))
|
|
AtomComponentProperties.grid('Grid Size'))
|
|
Report.result(Tests.grid_size, current_grid_size == 64)
|
|
Report.result(Tests.grid_size, current_grid_size == 64)
|
|
|
|
|
|
- # 6. Enter/Exit game mode.
|
|
|
|
|
|
+ # 6. Axis Color property value updated.
|
|
|
|
+ green_color_value = math.Color(13.0, 255.0, 0.0, 1.0)
|
|
|
|
+ grid_component.set_component_property_value(
|
|
|
|
+ AtomComponentProperties.grid('Axis Color'), value=green_color_value)
|
|
|
|
+ Report.result(Tests.axis_color,
|
|
|
|
+ grid_component.get_component_property_value(
|
|
|
|
+ AtomComponentProperties.grid('Axis Color')) == green_color_value)
|
|
|
|
+
|
|
|
|
+ # 7. Primary Grid Spacing property value updated.
|
|
|
|
+ grid_component.set_component_property_value(
|
|
|
|
+ AtomComponentProperties.grid('Primary Grid Spacing'), value=0.5)
|
|
|
|
+ Report.result(Tests.primary_grid_spacing,
|
|
|
|
+ grid_component.get_component_property_value(
|
|
|
|
+ AtomComponentProperties.grid('Primary Grid Spacing')) == 0.5)
|
|
|
|
+
|
|
|
|
+ # 8. Primary Color property value updated.
|
|
|
|
+ brown_color_value = math.Color(129.0, 96.0, 0.0, 1.0)
|
|
|
|
+ grid_component.set_component_property_value(
|
|
|
|
+ AtomComponentProperties.grid('Primary Color'), value=brown_color_value)
|
|
|
|
+ Report.result(Tests.primary_color,
|
|
|
|
+ grid_component.get_component_property_value(
|
|
|
|
+ AtomComponentProperties.grid('Primary Color')) == brown_color_value)
|
|
|
|
+
|
|
|
|
+ # 9. Secondary Grid Spacing property value updated.
|
|
|
|
+ grid_component.set_component_property_value(AtomComponentProperties.grid('Secondary Grid Spacing'), value=0.75)
|
|
|
|
+ Report.result(Tests.secondary_grid_spacing,
|
|
|
|
+ grid_component.get_component_property_value(
|
|
|
|
+ AtomComponentProperties.grid('Secondary Grid Spacing')) == 0.75)
|
|
|
|
+
|
|
|
|
+ # 10. Secondary Color property value updated.
|
|
|
|
+ blue_color_value = math.Color(0.0, 35.0, 161.0, 1.0)
|
|
|
|
+ grid_component.set_component_property_value(
|
|
|
|
+ AtomComponentProperties.grid('Secondary Color'), value=blue_color_value)
|
|
|
|
+ Report.result(Tests.secondary_color,
|
|
|
|
+ grid_component.get_component_property_value(
|
|
|
|
+ AtomComponentProperties.grid('Secondary Color')) == blue_color_value)
|
|
|
|
+
|
|
|
|
+ # 11. Enter/Exit game mode.
|
|
TestHelper.enter_game_mode(Tests.enter_game_mode)
|
|
TestHelper.enter_game_mode(Tests.enter_game_mode)
|
|
general.idle_wait_frames(1)
|
|
general.idle_wait_frames(1)
|
|
TestHelper.exit_game_mode(Tests.exit_game_mode)
|
|
TestHelper.exit_game_mode(Tests.exit_game_mode)
|
|
|
|
|
|
- # 7. Test IsHidden.
|
|
|
|
|
|
+ # 12. Test IsHidden.
|
|
grid_entity.set_visibility_state(False)
|
|
grid_entity.set_visibility_state(False)
|
|
Report.result(Tests.is_hidden, grid_entity.is_hidden() is True)
|
|
Report.result(Tests.is_hidden, grid_entity.is_hidden() is True)
|
|
|
|
|
|
- # 8. Test IsVisible.
|
|
|
|
|
|
+ # 13. Test IsVisible.
|
|
grid_entity.set_visibility_state(True)
|
|
grid_entity.set_visibility_state(True)
|
|
general.idle_wait_frames(1)
|
|
general.idle_wait_frames(1)
|
|
Report.result(Tests.is_visible, grid_entity.is_visible() is True)
|
|
Report.result(Tests.is_visible, grid_entity.is_visible() is True)
|
|
|
|
|
|
- # 9. Delete Grid entity.
|
|
|
|
|
|
+ # 14. Delete Grid entity.
|
|
grid_entity.delete()
|
|
grid_entity.delete()
|
|
Report.result(Tests.entity_deleted, not grid_entity.exists())
|
|
Report.result(Tests.entity_deleted, not grid_entity.exists())
|
|
|
|
|
|
- # 10. UNDO deletion.
|
|
|
|
|
|
+ # 15. UNDO deletion.
|
|
general.undo()
|
|
general.undo()
|
|
general.idle_wait_frames(1)
|
|
general.idle_wait_frames(1)
|
|
Report.result(Tests.deletion_undo, grid_entity.exists())
|
|
Report.result(Tests.deletion_undo, grid_entity.exists())
|
|
|
|
|
|
- # 11. REDO deletion.
|
|
|
|
|
|
+ # 16. REDO deletion.
|
|
general.redo()
|
|
general.redo()
|
|
general.idle_wait_frames(1)
|
|
general.idle_wait_frames(1)
|
|
Report.result(Tests.deletion_redo, not grid_entity.exists())
|
|
Report.result(Tests.deletion_redo, not grid_entity.exists())
|
|
|
|
|
|
- # 12. Look for errors or asserts.
|
|
|
|
|
|
+ # 17. Look for errors or asserts.
|
|
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
|
|
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
|
|
for error_info in error_tracer.errors:
|
|
for error_info in error_tracer.errors:
|
|
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
|
|
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
|