From b000b5fab3247489d568e5d2b75f70d8a17cddd4 Mon Sep 17 00:00:00 2001 From: Neil Widmaier Date: Fri, 5 Nov 2021 12:38:57 -0700 Subject: [PATCH 01/30] Adding P0 HDRi Skybox test Signed-off-by: Neil Widmaier --- .../Gem/PythonTests/Atom/TestSuite_Main.py | 4 + ...ra_AtomEditorComponents_HDRiSkyboxAdded.py | 159 ++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py diff --git a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main.py b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main.py index 52e7ec993e..6fc18f9043 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main.py @@ -53,6 +53,10 @@ class TestAutomation(EditorTestSuite): class AtomEditorComponents_HDRColorGradingAdded(EditorSharedTest): from Atom.tests import hydra_AtomEditorComponents_HDRColorGradingAdded as test_module + @pytest.mark.test_case_id("C32078116") + class AtomEditorComponents_HDRiSkyboxAdded(EditorSharedTest): + from Atom.tests import hydra_AtomEditorComponents_HDRiSkyboxAdded as test_module + @pytest.mark.test_case_id("C32078117") class AtomEditorComponents_LightAdded(EditorSharedTest): from Atom.tests import hydra_AtomEditorComponents_LightAdded as test_module diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py new file mode 100644 index 0000000000..92ac98f3ec --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py @@ -0,0 +1,159 @@ +""" +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 +""" + +class Tests: + creation_undo = ( + "UNDO Entity creation success", + "UNDO Entity creation failed") + creation_redo = ( + "REDO Entity creation success", + "REDO Entity creation failed") + hdri_skybox_entity_creation = ( + "HDRi Skybox successfully created", + "HDRi Skybox failed to be created") + hdri_skybox_entity_component_added = ( + "Entity has a HDRi Skybox component", + "Entity failed to find HDRi Skybox component") + enter_game_mode = ( + "Entered game mode", + "Failed to enter game mode") + exit_game_mode = ( + "Exited game mode", + "Couldn't exit game mode") + is_visible = ( + "Entity is visible", + "Entity was not visible") + is_hidden = ( + "Entity is hidden", + "Entity was not hidden") + entity_deleted = ( + "Entity deleted", + "Entity was not deleted") + deletion_undo = ( + "UNDO deletion success", + "UNDO deletion failed") + deletion_redo = ( + "REDO deletion success", + "REDO deletion failed") + + +def AtomEditorComponents_HDRiSkybox_AddedToEntity(): + """ + Summary: + Tests the HDRi Skybox component can be added to an entity and has the expected functionality. + + Test setup: + - Wait for Editor idle loop. + - Open the "Base" level. + + Expected Behavior: + The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components. + Creation and deletion undo/redo should also work. + + Test Steps: + 1) Create a HDRi Skybox with no components. + 2) Add a HDRi Skybox component to HDRi Skybox. + 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 HDRi Skybox. + 9) UNDO deletion. + 10) REDO deletion. + 11) Look for errors. + + :return: None + """ + + import azlmbr.legacy.general as general + + 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 + + with Tracer() as error_tracer: + # Test setup begins. + # Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level. + TestHelper.init_idle() + TestHelper.open_level("", "Base") + + # Test steps begin. + # 1. Create a HDRi Skybox with no components. + hdri_skybox_entity = EditorEntity.create_editor_entity( + AtomComponentProperties.hdri_skybox()) + Report.critical_result(Tests.hdri_skybox_entity_creation, + hdri_skybox_entity.exists()) + + # 2. Add a HDRi Skybox component to HDRi Skybox. + hdri_skybox_component = hdri_skybox_entity.add_component( + AtomComponentProperties.hdri_skybox()) + Report.critical_result( + Tests.hdri_skybox_entity_component_added, + hdri_skybox_entity.has_component(AtomComponentProperties.hdri_skybox())) + + # 3. UNDO the entity creation and component addition. + # -> UNDO component addition. + general.undo() + # -> UNDO naming entity. + general.undo() + # -> UNDO selecting entity. + general.undo() + # -> UNDO entity creation. + general.undo() + general.idle_wait_frames(1) + Report.result(Tests.creation_undo, not hdri_skybox_entity.exists()) + + # 4. REDO the entity creation and component addition. + # -> REDO entity creation. + general.redo() + # -> REDO selecting entity. + general.redo() + # -> REDO naming entity. + general.redo() + # -> REDO component addition. + general.redo() + general.idle_wait_frames(1) + Report.result(Tests.creation_redo, hdri_skybox_entity.exists()) + + # 5. 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. + hdri_skybox_entity.set_visibility_state(False) + Report.result(Tests.is_hidden, hdri_skybox_entity.is_hidden() is True) + + # 7. Test IsVisible. + hdri_skybox_entity.set_visibility_state(True) + general.idle_wait_frames(1) + Report.result(Tests.is_visible, hdri_skybox_entity.is_visible() is True) + + # 8. Delete hdri_skybox entity. + hdri_skybox_entity.delete() + Report.result(Tests.entity_deleted, not hdri_skybox_entity.exists()) + + # 9. UNDO deletion. + general.undo() + Report.result(Tests.deletion_undo, hdri_skybox_entity.exists()) + + # 10. REDO deletion. + general.redo() + Report.result(Tests.deletion_redo, not hdri_skybox_entity.exists()) + + # 11. Look for errors or 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}") + for assert_info in error_tracer.asserts: + Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}") + + +if __name__ == "__main__": + from editor_python_test_tools.utils import Report + Report.start_test(AtomEditorComponents_HDRiSkybox_AddedToEntity) From c886996bd7b4ac7abb01a5208c51375001d050cd Mon Sep 17 00:00:00 2001 From: Neil Widmaier Date: Fri, 5 Nov 2021 14:15:11 -0700 Subject: [PATCH 02/30] fixing typos and formatting Signed-off-by: Neil Widmaier --- .../hydra_AtomEditorComponents_HDRiSkyboxAdded.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py index 92ac98f3ec..835026a135 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py @@ -5,6 +5,7 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ + class Tests: creation_undo = ( "UNDO Entity creation success", @@ -16,7 +17,7 @@ class Tests: "HDRi Skybox successfully created", "HDRi Skybox failed to be created") hdri_skybox_entity_component_added = ( - "Entity has a HDRi Skybox component", + "Entity has an HDRi Skybox component", "Entity failed to find HDRi Skybox component") enter_game_mode = ( "Entered game mode", @@ -55,8 +56,8 @@ def AtomEditorComponents_HDRiSkybox_AddedToEntity(): Creation and deletion undo/redo should also work. Test Steps: - 1) Create a HDRi Skybox with no components. - 2) Add a HDRi Skybox component to HDRi Skybox. + 1) Create an HDRi Skybox with no components. + 2) Add an HDRi Skybox component to HDRi Skybox. 3) UNDO the entity creation and component addition. 4) REDO the entity creation and component addition. 5) Enter/Exit game mode. @@ -83,13 +84,13 @@ def AtomEditorComponents_HDRiSkybox_AddedToEntity(): TestHelper.open_level("", "Base") # Test steps begin. - # 1. Create a HDRi Skybox with no components. + # 1. Create an HDRi Skybox with no components. hdri_skybox_entity = EditorEntity.create_editor_entity( AtomComponentProperties.hdri_skybox()) Report.critical_result(Tests.hdri_skybox_entity_creation, hdri_skybox_entity.exists()) - # 2. Add a HDRi Skybox component to HDRi Skybox. + # 2. Add an HDRi Skybox component to HDRi Skybox. hdri_skybox_component = hdri_skybox_entity.add_component( AtomComponentProperties.hdri_skybox()) Report.critical_result( From 9d656005c48b85778d26e048539c03e5b555fe80 Mon Sep 17 00:00:00 2001 From: Neil Widmaier Date: Fri, 5 Nov 2021 14:48:15 -0700 Subject: [PATCH 03/30] Adding fmt comments Signed-off-by: Neil Widmaier --- .../tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py index 835026a135..0576de0a62 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py @@ -6,6 +6,9 @@ SPDX-License-Identifier: Apache-2.0 OR MIT """ +#fmt: off + + class Tests: creation_undo = ( "UNDO Entity creation success", @@ -42,6 +45,9 @@ class Tests: "REDO deletion failed") +#fmt: on + + def AtomEditorComponents_HDRiSkybox_AddedToEntity(): """ Summary: From c29ca07d541086145edbe80277bfb27b4d7a41d7 Mon Sep 17 00:00:00 2001 From: sweeneys Date: Wed, 10 Nov 2021 15:34:08 -0800 Subject: [PATCH 04/30] Enable python-based tests in Linux AR Signed-off-by: sweeneys --- .../ly_test_tools/environment/process_utils.py | 9 +++++---- Tools/LyTestTools/tests/unit/test_process_utils.py | 6 +++--- cmake/Platform/Linux/PAL_linux.cmake | 2 +- scripts/build/Platform/Linux/build_config.json | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Tools/LyTestTools/ly_test_tools/environment/process_utils.py b/Tools/LyTestTools/ly_test_tools/environment/process_utils.py index f8245495fa..44288203da 100755 --- a/Tools/LyTestTools/ly_test_tools/environment/process_utils.py +++ b/Tools/LyTestTools/ly_test_tools/environment/process_utils.py @@ -20,6 +20,7 @@ _PROCESS_OUTPUT_ENCODING = 'utf-8' # Default list of processes names to kill LY_PROCESS_KILL_LIST = [ + 'AssetBuilder', 'AssetProcessor', 'AssetProcessorBatch', 'CrySCompileServer', 'Editor', 'Profiler', 'RemoteConsole', 'rc' # Resource Compiler @@ -376,18 +377,18 @@ def _safe_kill_processes(processes): logger.info(f"Terminating process '{proc.name()}' with id '{proc.pid}'") proc.kill() except psutil.AccessDenied: - logger.warning("Termination failed, Access Denied", exc_info=True) + logger.warning("Termination failed, Access Denied with stacktrace:", exc_info=True) except psutil.NoSuchProcess: - logger.debug("Termination request ignored, process was already terminated during iteration", exc_info=True) + logger.debug("Termination request ignored, process was already terminated during iteration with stacktrace:", exc_info=True) except Exception: # purposefully broad - logger.warning("Unexpected exception ignored while terminating process", exc_info=True) + logger.debug("Unexpected exception ignored while terminating process, with stacktrace:", exc_info=True) def on_terminate(proc): logger.info(f"process '{proc.name()}' with id '{proc.pid}' terminated with exit code {proc.returncode}") try: psutil.wait_procs(processes, timeout=30, callback=on_terminate) except Exception: # purposefully broad - logger.warning("Unexpected exception while waiting for processes to terminate", exc_info=True) + logger.debug("Unexpected exception while waiting for processes to terminate, with stacktrace:", exc_info=True) def _terminate_and_confirm_dead(proc): diff --git a/Tools/LyTestTools/tests/unit/test_process_utils.py b/Tools/LyTestTools/tests/unit/test_process_utils.py index bd6a79fb09..87b5790b78 100755 --- a/Tools/LyTestTools/tests/unit/test_process_utils.py +++ b/Tools/LyTestTools/tests/unit/test_process_utils.py @@ -371,15 +371,15 @@ class TestProcessMatching(unittest.TestCase): mock_log_warn.assert_called() @mock.patch('psutil.wait_procs') - @mock.patch('logging.Logger.warning') - def test_SafeKillProcList_RaisesError_NoRaiseAndLogsError(self, mock_log_warn, mock_wait_procs): + @mock.patch('logging.Logger.debug') + def test_SafeKillProcList_RaisesError_NoRaiseAndLogsError(self, mock_log, mock_wait_procs): mock_wait_procs.side_effect = psutil.PermissionError() proc_mock = mock.MagicMock() process_utils._safe_kill_processes(proc_mock) mock_wait_procs.assert_called() - mock_log_warn.assert_called() + mock_log.assert_called() @mock.patch('psutil.process_iter') @mock.patch('logging.Logger.debug') diff --git a/cmake/Platform/Linux/PAL_linux.cmake b/cmake/Platform/Linux/PAL_linux.cmake index e74adb287e..4941f143a6 100644 --- a/cmake/Platform/Linux/PAL_linux.cmake +++ b/cmake/Platform/Linux/PAL_linux.cmake @@ -23,7 +23,7 @@ ly_set(PAL_TRAIT_PROF_PIX_SUPPORTED FALSE) # Test library support ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED TRUE) ly_set(PAL_TRAIT_TEST_GOOGLE_BENCHMARK_SUPPORTED TRUE) -ly_set(PAL_TRAIT_TEST_LYTESTTOOLS_SUPPORTED FALSE) +ly_set(PAL_TRAIT_TEST_LYTESTTOOLS_SUPPORTED TRUE) ly_set(PAL_TRAIT_TEST_PYTEST_SUPPORTED TRUE) ly_set(PAL_TRAIT_TEST_TARGET_TYPE MODULE) diff --git a/scripts/build/Platform/Linux/build_config.json b/scripts/build/Platform/Linux/build_config.json index 103f243aae..11d61d8885 100644 --- a/scripts/build/Platform/Linux/build_config.json +++ b/scripts/build/Platform/Linux/build_config.json @@ -83,7 +83,7 @@ "CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_PARALLEL_LINK_JOBS=4", "CMAKE_LY_PROJECTS": "AutomatedTesting", "CMAKE_TARGET": "all", - "CTEST_OPTIONS": "-E Gem::EMotionFX.Editor.Tests -LE (SUITE_sandbox|SUITE_awsi) -L FRAMEWORK_googletest --no-tests=error", + "CTEST_OPTIONS": "-E (Gem::EMotionFX.Editor.Tests|Gem::EMotionFX.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", "TEST_RESULTS": "True" } }, @@ -96,7 +96,7 @@ "CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_UNITY_BUILD=FALSE -DLY_PARALLEL_LINK_JOBS=4", "CMAKE_LY_PROJECTS": "AutomatedTesting", "CMAKE_TARGET": "all", - "CTEST_OPTIONS": "-E Gem::EMotionFX.Editor.Tests -LE (SUITE_sandbox|SUITE_awsi) -L FRAMEWORK_googletest --no-tests=error", + "CTEST_OPTIONS": "-E (Gem::EMotionFX.Editor.Tests|Gem::EMotionFX.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", "TEST_RESULTS": "True" } }, From d93ac7d791d90735952368b884578abd0882d189 Mon Sep 17 00:00:00 2001 From: sweeneys Date: Wed, 10 Nov 2021 16:51:33 -0800 Subject: [PATCH 05/30] remove ignored modules Signed-off-by: sweeneys --- scripts/build/Platform/Linux/build_config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build/Platform/Linux/build_config.json b/scripts/build/Platform/Linux/build_config.json index 11d61d8885..e84dfcce91 100644 --- a/scripts/build/Platform/Linux/build_config.json +++ b/scripts/build/Platform/Linux/build_config.json @@ -83,7 +83,7 @@ "CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_PARALLEL_LINK_JOBS=4", "CMAKE_LY_PROJECTS": "AutomatedTesting", "CMAKE_TARGET": "all", - "CTEST_OPTIONS": "-E (Gem::EMotionFX.Editor.Tests|Gem::EMotionFX.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", + "CTEST_OPTIONS": "-L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", "TEST_RESULTS": "True" } }, @@ -96,7 +96,7 @@ "CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_UNITY_BUILD=FALSE -DLY_PARALLEL_LINK_JOBS=4", "CMAKE_LY_PROJECTS": "AutomatedTesting", "CMAKE_TARGET": "all", - "CTEST_OPTIONS": "-E (Gem::EMotionFX.Editor.Tests|Gem::EMotionFX.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", + "CTEST_OPTIONS": "-L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", "TEST_RESULTS": "True" } }, From bf00d82b025c80c0b9015d49c28a62059c1e1c9a Mon Sep 17 00:00:00 2001 From: sweeneys Date: Wed, 10 Nov 2021 17:26:32 -0800 Subject: [PATCH 06/30] Fix linux-specific test failures Signed-off-by: sweeneys --- .../smoke/test_CLITool_SerializeContextTools_Works.py | 3 +++ Tools/LyTestTools/tests/unit/test_editor_test_utils.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py index a3f6b8b09f..20960d9ee8 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py @@ -13,7 +13,10 @@ import os import pytest import subprocess +import ly_test_tools + +@pytest.mark.skipif(not ly_test_tools.WINDOWS, "SerializeContextTools only available on Windows") @pytest.mark.SUITE_smoke class TestCLIToolSerializeContextToolsWorks(object): def test_CLITool_SerializeContextTools_Works(self, build_directory): diff --git a/Tools/LyTestTools/tests/unit/test_editor_test_utils.py b/Tools/LyTestTools/tests/unit/test_editor_test_utils.py index bf7fae7189..db59d18610 100644 --- a/Tools/LyTestTools/tests/unit/test_editor_test_utils.py +++ b/Tools/LyTestTools/tests/unit/test_editor_test_utils.py @@ -74,9 +74,9 @@ class TestEditorTestUtils(unittest.TestCase): def test_RetrieveCrashOutput_CrashLogNotExists_ReturnsError(self, mock_retrieve_log_path): mock_retrieve_log_path.return_value = 'mock_log_path' mock_workspace = mock.MagicMock() - expected = "-- No crash log available --\n[Errno 2] No such file or directory: 'mock_log_path\\\\error.log'" + error_message = "No crash log available" - assert expected == editor_test_utils.retrieve_crash_output(0, mock_workspace, 0) + assert error_message in editor_test_utils.retrieve_crash_output(0, mock_workspace, 0) @mock.patch('os.path.getmtime', mock.MagicMock()) @mock.patch('os.rename') From e0c2fd90b18076e348c61bb23092ed70321eded2 Mon Sep 17 00:00:00 2001 From: sweeneys Date: Wed, 10 Nov 2021 18:56:02 -0800 Subject: [PATCH 07/30] Disable failing modules, add explicit skip-reason Signed-off-by: sweeneys --- .../smoke/test_CLITool_SerializeContextTools_Works.py | 2 +- scripts/build/Platform/Linux/build_config.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py index 20960d9ee8..fb37200a92 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py @@ -16,7 +16,7 @@ import subprocess import ly_test_tools -@pytest.mark.skipif(not ly_test_tools.WINDOWS, "SerializeContextTools only available on Windows") +@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="SerializeContextTools only available on Windows") @pytest.mark.SUITE_smoke class TestCLIToolSerializeContextToolsWorks(object): def test_CLITool_SerializeContextTools_Works(self, build_directory): diff --git a/scripts/build/Platform/Linux/build_config.json b/scripts/build/Platform/Linux/build_config.json index e84dfcce91..0370170a3a 100644 --- a/scripts/build/Platform/Linux/build_config.json +++ b/scripts/build/Platform/Linux/build_config.json @@ -83,7 +83,7 @@ "CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_PARALLEL_LINK_JOBS=4", "CMAKE_LY_PROJECTS": "AutomatedTesting", "CMAKE_TARGET": "all", - "CTEST_OPTIONS": "-L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", + "CTEST_OPTIONS": "-E (AutomatedTesting::Atom_TestSuite_Main|AutomatedTesting::PhysicsTests_Main|AutomatedTesting::PrefabTests|Gem::EMotionFX.Editor.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", "TEST_RESULTS": "True" } }, @@ -96,7 +96,7 @@ "CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_UNITY_BUILD=FALSE -DLY_PARALLEL_LINK_JOBS=4", "CMAKE_LY_PROJECTS": "AutomatedTesting", "CMAKE_TARGET": "all", - "CTEST_OPTIONS": "-L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", + "CTEST_OPTIONS": "-E (AutomatedTesting::Atom_TestSuite_Main|AutomatedTesting::PhysicsTests_Main|AutomatedTesting::PrefabTests|Gem::EMotionFX.Editor.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", "TEST_RESULTS": "True" } }, From b482a1a6a10dc093a5d65b88ede924b6c7a4ae25 Mon Sep 17 00:00:00 2001 From: sweeneys Date: Wed, 10 Nov 2021 21:56:56 -0800 Subject: [PATCH 08/30] Disable failing smoke tests on Linux Signed-off-by: sweeneys --- .../smoke/test_CLITool_SerializeContextTools_Works.py | 2 +- .../PythonTests/smoke/test_Editor_NewExistingLevels_Works.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py index fb37200a92..4d883745c9 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py @@ -16,7 +16,7 @@ import subprocess import ly_test_tools -@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="SerializeContextTools only available on Windows") +@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="Only suceeds on windows https://github.com/o3de/o3de/issues/5539") @pytest.mark.SUITE_smoke class TestCLIToolSerializeContextToolsWorks(object): def test_CLITool_SerializeContextTools_Works(self, build_directory): diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py index 6f654b9107..b437a21618 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py @@ -15,6 +15,7 @@ import ly_test_tools.environment.file_system as file_system @pytest.mark.SUITE_smoke +@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="Only suceeds on windows https://github.com/o3de/o3de/issues/5539") @pytest.mark.parametrize("launcher_platform", ["windows_editor"]) @pytest.mark.parametrize("project", ["AutomatedTesting"]) @pytest.mark.parametrize("level", ["temp_level"]) From c08351391695b66c8b142f0149335b8244f82c66 Mon Sep 17 00:00:00 2001 From: sweeneys Date: Wed, 10 Nov 2021 22:57:05 -0800 Subject: [PATCH 09/30] add missing import Signed-off-by: sweeneys --- .../PythonTests/smoke/test_Editor_NewExistingLevels_Works.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py index b437a21618..b012da33fe 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py @@ -11,6 +11,8 @@ Test should run in both gpu and non gpu import pytest import os from automatedtesting_shared.base import TestAutomationBase + +import ly_test_tools import ly_test_tools.environment.file_system as file_system From 10619d53bf03e694ba5eb82a740b3c84c7dc2a3c Mon Sep 17 00:00:00 2001 From: sweeneys Date: Thu, 11 Nov 2021 10:20:01 -0800 Subject: [PATCH 10/30] fix spelling Signed-off-by: sweeneys --- .../smoke/test_CLITool_SerializeContextTools_Works.py | 2 +- .../PythonTests/smoke/test_Editor_NewExistingLevels_Works.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py index 4d883745c9..917ff17f82 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_CLITool_SerializeContextTools_Works.py @@ -16,7 +16,7 @@ import subprocess import ly_test_tools -@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="Only suceeds on windows https://github.com/o3de/o3de/issues/5539") +@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="Only succeeds on windows https://github.com/o3de/o3de/issues/5539") @pytest.mark.SUITE_smoke class TestCLIToolSerializeContextToolsWorks(object): def test_CLITool_SerializeContextTools_Works(self, build_directory): diff --git a/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py index b012da33fe..e6378982ba 100644 --- a/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py +++ b/AutomatedTesting/Gem/PythonTests/smoke/test_Editor_NewExistingLevels_Works.py @@ -17,7 +17,7 @@ import ly_test_tools.environment.file_system as file_system @pytest.mark.SUITE_smoke -@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="Only suceeds on windows https://github.com/o3de/o3de/issues/5539") +@pytest.mark.skipif(not ly_test_tools.WINDOWS, reason="Only succeeds on windows https://github.com/o3de/o3de/issues/5539") @pytest.mark.parametrize("launcher_platform", ["windows_editor"]) @pytest.mark.parametrize("project", ["AutomatedTesting"]) @pytest.mark.parametrize("level", ["temp_level"]) From 98f589745b1aa6a911b49812c7ec920f8b52f2fe Mon Sep 17 00:00:00 2001 From: Neil Widmaier Date: Fri, 12 Nov 2021 10:55:52 -0800 Subject: [PATCH 11/30] Adding step to assign a cubemap Signed-off-by: Neil Widmaier --- .../Gem/PythonTests/Atom/TestSuite_Main.py | 16 ++++++++ ...ra_AtomEditorComponents_HDRiSkyboxAdded.py | 41 ++++++++++++------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main.py b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main.py index 6fc18f9043..b4de39ae98 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/TestSuite_Main.py @@ -29,6 +29,10 @@ class TestAutomation(EditorTestSuite): class AtomEditorComponents_DepthOfFieldAdded(EditorSharedTest): from Atom.tests import hydra_AtomEditorComponents_DepthOfFieldAdded as test_module + @pytest.mark.test_case_id("C36525659") + class AtomEditorComponents_DiffuseProbeGridAdded(EditorSharedTest): + from Atom.tests import hydra_AtomEditorComponents_DiffuseProbeGridAdded as test_module + @pytest.mark.test_case_id("C32078120") class AtomEditorComponents_DirectionalLightAdded(EditorSharedTest): from Atom.tests import hydra_AtomEditorComponents_DirectionalLightAdded as test_module @@ -37,6 +41,10 @@ class TestAutomation(EditorTestSuite): class AtomEditorComponents_DisplayMapperAdded(EditorSharedTest): from Atom.tests import hydra_AtomEditorComponents_DisplayMapperAdded as test_module + @pytest.mark.test_case_id("C36525661") + class AtomEditorComponents_EntityReferenceAdded(EditorSharedTest): + from Atom.tests import hydra_AtomEditorComponents_EntityReferenceAdded as test_module + @pytest.mark.test_case_id("C32078121") class AtomEditorComponents_ExposureControlAdded(EditorSharedTest): from Atom.tests import hydra_AtomEditorComponents_ExposureControlAdded as test_module @@ -61,6 +69,10 @@ class TestAutomation(EditorTestSuite): class AtomEditorComponents_LightAdded(EditorSharedTest): from Atom.tests import hydra_AtomEditorComponents_LightAdded as test_module + @pytest.mark.test_case_id("C36525662") + class AtomEditorComponents_LookModificationAdded(EditorSharedTest): + from Atom.tests import hydra_AtomEditorComponents_LookModificationAdded as test_module + @pytest.mark.test_case_id("C32078123") class AtomEditorComponents_MaterialAdded(EditorSharedTest): from Atom.tests import hydra_AtomEditorComponents_MaterialAdded as test_module @@ -98,5 +110,9 @@ class TestAutomation(EditorTestSuite): class AtomEditorComponents_ReflectionProbeAdded(EditorSharedTest): from Atom.tests import hydra_AtomEditorComponents_ReflectionProbeAdded as test_module + @pytest.mark.test_case_id("C36525666") + class AtomEditorComponents_SSAOAdded(EditorSharedTest): + from Atom.tests import hydra_AtomEditorComponents_SSAOAdded as test_module + class ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges(EditorSharedTest): from Atom.tests import hydra_ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges as test_module diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py index 0576de0a62..0f96bc5424 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomEditorComponents_HDRiSkyboxAdded.py @@ -6,9 +6,6 @@ SPDX-License-Identifier: Apache-2.0 OR MIT """ -#fmt: off - - class Tests: creation_undo = ( "UNDO Entity creation success", @@ -19,9 +16,12 @@ class Tests: hdri_skybox_entity_creation = ( "HDRi Skybox successfully created", "HDRi Skybox failed to be created") - hdri_skybox_entity_component_added = ( + hdri_skybox_component = ( "Entity has an HDRi Skybox component", "Entity failed to find HDRi Skybox component") + cubemap_property_set = ( + "Cubemap property set on HDRi Skybox component", + "Couldn't set Cubemap property on HDRi Skybox component") enter_game_mode = ( "Entered game mode", "Failed to enter game mode") @@ -45,9 +45,6 @@ class Tests: "REDO deletion failed") -#fmt: on - - def AtomEditorComponents_HDRiSkybox_AddedToEntity(): """ Summary: @@ -77,8 +74,11 @@ def AtomEditorComponents_HDRiSkybox_AddedToEntity(): :return: None """ + import os + import azlmbr.legacy.general as general + from editor_python_test_tools.asset_utils import Asset 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 @@ -100,7 +100,7 @@ def AtomEditorComponents_HDRiSkybox_AddedToEntity(): hdri_skybox_component = hdri_skybox_entity.add_component( AtomComponentProperties.hdri_skybox()) Report.critical_result( - Tests.hdri_skybox_entity_component_added, + Tests.hdri_skybox_component, hdri_skybox_entity.has_component(AtomComponentProperties.hdri_skybox())) # 3. UNDO the entity creation and component addition. @@ -127,33 +127,44 @@ def AtomEditorComponents_HDRiSkybox_AddedToEntity(): general.idle_wait_frames(1) Report.result(Tests.creation_redo, hdri_skybox_entity.exists()) - # 5. Enter/Exit game mode. + + # 5. Set Cubemap Texture on HDRi Skybox component. + skybox_cubemap_asset_path = os.path.join("LightingPresets", "default_iblskyboxcm.exr.streamingimage") + skybox_cubemap_material_asset = Asset.find_asset_by_path(skybox_cubemap_asset_path, False) + hdri_skybox_component.set_component_property_value( + AtomComponentProperties.hdri_skybox('Cubemap Texture'), skybox_cubemap_material_asset.id) + get_cubemap_property = hdri_skybox_component.get_component_property_value( + AtomComponentProperties.hdri_skybox('Cubemap Texture')) + Report.result(Tests.cubemap_property_set, get_cubemap_property == skybox_cubemap_material_asset.id) + + + # 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. hdri_skybox_entity.set_visibility_state(False) Report.result(Tests.is_hidden, hdri_skybox_entity.is_hidden() is True) - # 7. Test IsVisible. + # 8. Test IsVisible. hdri_skybox_entity.set_visibility_state(True) general.idle_wait_frames(1) Report.result(Tests.is_visible, hdri_skybox_entity.is_visible() is True) - # 8. Delete hdri_skybox entity. + # 9. Delete hdri_skybox entity. hdri_skybox_entity.delete() Report.result(Tests.entity_deleted, not hdri_skybox_entity.exists()) - # 9. UNDO deletion. + # 10. UNDO deletion. general.undo() Report.result(Tests.deletion_undo, hdri_skybox_entity.exists()) - # 10. REDO deletion. + # 11. REDO deletion. general.redo() Report.result(Tests.deletion_redo, not hdri_skybox_entity.exists()) - # 11. Look for errors or asserts. + # 12. Look for errors or 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}") From 11c219701e4cb547fa5c466796e33ff84a57efb2 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Fri, 12 Nov 2021 15:47:18 -0600 Subject: [PATCH 12/30] Initial check-in of in-memory prefab creation helpers for Dynamic Vegetation tests Signed-off-by: jckand-amzn --- .../editor_entity_utils.py | 4 +- .../DynVegUtils_TempPrefabCreationWorks.py | 90 +++++++++++++++++++ .../dyn_veg/TestSuite_Periodic_Optimized.py | 22 +++++ .../editor_dynveg_test_helper.py | 55 +++++++++++- 4 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py create mode 100644 AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/TestSuite_Periodic_Optimized.py diff --git a/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/editor_entity_utils.py b/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/editor_entity_utils.py index 9e857ed8bc..aee8846afe 100644 --- a/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/editor_entity_utils.py +++ b/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/editor_entity_utils.py @@ -132,6 +132,7 @@ class EditorEntity: def __init__(self, id: azlmbr.entity.EntityId): self.id: azlmbr.entity.EntityId = id + self.components: List[EditorComponent] = [] # Creation functions @classmethod @@ -258,6 +259,7 @@ class EditorEntity: :return: Component object of newly added component. """ component = self.add_components([component_name])[0] + self.components.append(component) return component def add_components(self, component_names: list) -> List[EditorComponent]: @@ -279,7 +281,7 @@ class EditorEntity: ), f"Failure: Could not add component: '{new_comp.get_component_name()}' to entity: '{self.get_name()}'" new_comp.id = add_component_outcome.GetValue()[0] components.append(new_comp) - + self.components.append(new_comp) return components def get_components_of_type(self, component_names: list) -> List[EditorComponent]: diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py new file mode 100644 index 0000000000..d684d7eb02 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py @@ -0,0 +1,90 @@ +""" +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 DynVegUtils_TempPrefabCreationWorks(): + """ + Summary: + An existing level is opened. Each Prefab setup to be spawned by Dynamic Vegetation tests is created in memory and + validated against existing components/mesh assignments. A spawner is then created with the temporary prefabs to ensure + proper functionality with Dynamic Vegetation components. + + Expected Behavior: + Temporary prefabs contain the expected components/assets. Instances plant as expected in the assigned area. + + Test Steps: + 1) Open an existing level + 2) Create each of the necessary temporary prefabs, and validate the component/mesh setups + 3) Create a Vegetation Layer Spawner setup using the temporary prefabs as Prefab Instance Spawner types + 4) Create a surface to plant on and validate instance counts + 5) Verify expected instance counts + + Note: + - This test file must be called from the Open 3D Engine Editor command terminal + - Any passed and failed tests are written to the Editor.log file. + Parsing the file or running a log_monitor are required to observe the test results. + + :return: None + """ + + import os + + import azlmbr.editor as editor + import azlmbr.legacy.general as general + import azlmbr.bus as bus + import azlmbr.math as math + + import editor_python_test_tools.hydra_editor_utils as hydra + from largeworlds.large_worlds_utils import editor_dynveg_test_helper as dynveg + from editor_python_test_tools.utils import Report, Tracer + from editor_python_test_tools.utils import TestHelper as helper + from editor_python_test_tools.prefab_utils import Prefab, PrefabInstance, get_prefab_file_path + + with Tracer() as error_tracer: + # Create dictionary for prefab filenames and paths to create using helper function + mesh_prefabs = { + "PinkFlower": os.path.join("assets", "objects", "foliage", "grass_flower_pink.azmodel"), + "PurpleFlower": os.path.join("assets", "objects", "foliage", "grass_flower_purple.azmodel"), + "1m_Cube": os.path.join("objects", "_primitives", "_box_1x1.azmodel"), + "CedarTree": os.path.join("assets", "objects", "foliage", "cedar.azmodel"), + "Bush": os.path.join("assets", "objects", "foliage", "bush_privet_01.azmodel"), + } + + # 1) Open an existing simple level + helper.init_idle() + helper.open_level("Prefab", "Base") + + # 2) Create a Dynamic Vegetation surface in preparation of prefab creation + center_point = math.Vector3(0.0, 0.0, 0.0) + dynveg.create_surface_entity("Planting Surface", center_point, 128.0, 128.0, 1.0) + + # 3) Create each of the Mesh asset prefabs and validate that the prefab created successfully + for prefab_filename, asset_path in mesh_prefabs.items(): + prefab_created = ( + f"Temporary {prefab_filename} prefab created successfully", + f"Failed to create temporary {prefab_filename} prefab" + ) + prefab = dynveg.create_temp_mesh_prefab(asset_path, prefab_filename) + Report.result(prefab_created, helper.wait_for_condition(lambda: PrefabInstance.is_valid(prefab[1]), 3.0)) + + # 4) Assign the temp prefab to the prefab instance spawner, and validate the instance count + #for prefab_filename in mesh_prefabs: + spawner_entity = dynveg.create_prefab_spawner("PrefabSpawner", center_point, 16.0, 16.0, 16.0, + get_prefab_file_path("Sphere")) + + # 5) Report errors/asserts + helper.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}") + for assert_info in error_tracer.asserts: + Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}") + + general.idle_wait(20.0) +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test(DynVegUtils_TempPrefabCreationWorks) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/TestSuite_Periodic_Optimized.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/TestSuite_Periodic_Optimized.py new file mode 100644 index 0000000000..764d2dec75 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/TestSuite_Periodic_Optimized.py @@ -0,0 +1,22 @@ +""" +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 +""" + +import os +import pytest + +import ly_test_tools.environment.file_system as file_system +from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite + + +@pytest.mark.SUITE_main +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomation(EditorTestSuite): + global_extra_cmdline_args = [] + + class test_DynVegUtils_TempPrefabCreationWorks(EditorSharedTest): + from .EditorScripts import DynVegUtils_TempPrefabCreationWorks as test_module diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py index 957536fffb..3004038b7f 100755 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py @@ -19,6 +19,25 @@ import azlmbr.paths sys.path.append(os.path.join(azlmbr.paths.projectroot, 'Gem', 'PythonTests')) import editor_python_test_tools.hydra_editor_utils as hydra +from editor_python_test_tools.editor_entity_utils import EditorEntity, EditorComponent +from editor_python_test_tools.prefab_utils import Prefab + + +def create_temp_mesh_prefab(mesh_asset_path, prefab_filename): + # Create initial entity + root = EditorEntity.create_editor_entity(name=prefab_filename) + assert root.exists(), "Failed to create entity" + # Add mesh component + mesh_component = root.add_component("Mesh") + assert root.has_component("Mesh") and mesh_component.is_enabled(), "Failed to add/activate Mesh component" + # Assign the specified mesh asset + mesh_asset = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", mesh_asset_path, math.Uuid(), False) + mesh_component.set_component_property_value("Controller|Configuration|Mesh Asset", mesh_asset) + assert mesh_component.get_component_property_value("Controller|Configuration|Mesh Asset"), \ + "Failed to set Mesh asset" + # Create and return the temporary/in-memory prefab + temp_prefab = Prefab.create_prefab([root], prefab_filename) + return temp_prefab def create_surface_entity(name, center_point, box_size_x, box_size_y, box_size_z): @@ -52,6 +71,40 @@ def create_mesh_surface_entity_with_slopes(name, center_point, uniform_scale): return surface_entity +def create_prefab_spawner(name, center_point, box_size_x, box_size_y, box_size_z, prefab_asset_path): + # Create a vegetation area entity to use as our test vegetation spawner + spawner_entity = EditorEntity.create_editor_entity_at(center_point, name=name) + spawner_entity.add_components(["Vegetation Layer Spawner", "Box Shape", "Vegetation Asset List"]) + if spawner_entity.id.IsValid(): + print(f"'{spawner_entity.get_name()}' created") + spawner_entity.components[1].set_component_property_value("Box Shape|Box Configuration|Dimensions", + math.Vector3(box_size_x, box_size_y, box_size_z)) + + # Set the vegetation area to a Prefab spawner with a specific prefab asset selected + prefab_spawner = vegetation.PrefabInstanceSpawner() + prefab_spawner.SetPrefabAssetPath(prefab_asset_path) + descriptor = spawner_entity.components[2].get_component_property_value("Configuration|Embedded Assets|[0]") + descriptor.spawner = prefab_spawner + spawner_entity.components[2].set_component_property_value("Configuration|Embedded Assets|[0]", descriptor) + return spawner_entity + +def create_empty_spawner(name, center_point, box_size_x, box_size_y, box_size_z): + # Create a vegetation area entity to use as our test vegetation spawner + spawner_entity = EditorEntity.create_editor_entity_at(center_point, name=name) + spawner_entity.add_components(["Vegetation Layer Spawner", "Box Shape", "Vegetation Asset List"]) + if spawner_entity.id.IsValid(): + print(f"'{spawner_entity.get_name()}' created") + spawner_entity.components[1].set_component_property_value("Box Shape|Box Configuration|Dimensions", + math.Vector3(box_size_x, box_size_y, box_size_z)) + + # Set the vegetation area to an empty spawner + empty_spawner = vegetation.EmptyInstanceSpawner() + descriptor = spawner_entity.components[2].get_component_property_value("Configuration|Embedded Assets|[0]") + descriptor.spawner = empty_spawner + spawner_entity.components[2].set_component_property_value("Configuration|Embedded Assets|[0]", descriptor) + return spawner_entity + + def create_vegetation_area(name, center_point, box_size_x, box_size_y, box_size_z, dynamic_slice_asset_path): # Create a vegetation area entity to use as our test vegetation spawner spawner_entity = hydra.Entity(name) @@ -67,7 +120,7 @@ def create_vegetation_area(name, center_point, box_size_x, box_size_y, box_size_ # Set the vegetation area to a Dynamic Slice spawner with a specific slice asset selected dynamic_slice_spawner = vegetation.DynamicSliceInstanceSpawner() dynamic_slice_spawner.SetSliceAssetPath(dynamic_slice_asset_path) - descriptor = hydra.get_component_property_value(spawner_entity.components[2], 'Configuration|Embedded Assets|[0]') + descriptor = vegetation.Descriptor() descriptor.spawner = dynamic_slice_spawner spawner_entity.get_set_test(2, "Configuration|Embedded Assets|[0]", descriptor) return spawner_entity From 0d3ab12d4221596d163a37b60badc6ef41b55687 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Fri, 12 Nov 2021 16:34:57 -0600 Subject: [PATCH 13/30] Removing unused imports and debug waits Signed-off-by: jckand-amzn --- .../DynVegUtils_TempPrefabCreationWorks.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py index d684d7eb02..6f0aace162 100644 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py @@ -33,12 +33,8 @@ def DynVegUtils_TempPrefabCreationWorks(): import os - import azlmbr.editor as editor - import azlmbr.legacy.general as general - import azlmbr.bus as bus import azlmbr.math as math - import editor_python_test_tools.hydra_editor_utils as hydra from largeworlds.large_worlds_utils import editor_dynveg_test_helper as dynveg from editor_python_test_tools.utils import Report, Tracer from editor_python_test_tools.utils import TestHelper as helper @@ -72,9 +68,9 @@ def DynVegUtils_TempPrefabCreationWorks(): Report.result(prefab_created, helper.wait_for_condition(lambda: PrefabInstance.is_valid(prefab[1]), 3.0)) # 4) Assign the temp prefab to the prefab instance spawner, and validate the instance count - #for prefab_filename in mesh_prefabs: - spawner_entity = dynveg.create_prefab_spawner("PrefabSpawner", center_point, 16.0, 16.0, 16.0, - get_prefab_file_path("Sphere")) + for prefab_filename in mesh_prefabs: + spawner_entity = dynveg.create_prefab_spawner("PrefabSpawner", center_point, 16.0, 16.0, 16.0, + get_prefab_file_path(get_prefab_file_path(prefab_filename))) # 5) Report errors/asserts helper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0) @@ -83,7 +79,7 @@ def DynVegUtils_TempPrefabCreationWorks(): for assert_info in error_tracer.asserts: Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}") - general.idle_wait(20.0) + if __name__ == "__main__": from editor_python_test_tools.utils import Report From 80a6658c9d59026c6ac0e40a95ba27ecbf6a5607 Mon Sep 17 00:00:00 2001 From: sweeneys Date: Fri, 12 Nov 2021 16:46:46 -0800 Subject: [PATCH 14/30] disable TerrainTests Signed-off-by: sweeneys --- scripts/build/Platform/Linux/build_config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build/Platform/Linux/build_config.json b/scripts/build/Platform/Linux/build_config.json index 0370170a3a..3ae34bf16a 100644 --- a/scripts/build/Platform/Linux/build_config.json +++ b/scripts/build/Platform/Linux/build_config.json @@ -83,7 +83,7 @@ "CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_PARALLEL_LINK_JOBS=4", "CMAKE_LY_PROJECTS": "AutomatedTesting", "CMAKE_TARGET": "all", - "CTEST_OPTIONS": "-E (AutomatedTesting::Atom_TestSuite_Main|AutomatedTesting::PhysicsTests_Main|AutomatedTesting::PrefabTests|Gem::EMotionFX.Editor.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", + "CTEST_OPTIONS": "-E (AutomatedTesting::Atom_TestSuite_Main|AutomatedTesting::PhysicsTests_Main|AutomatedTesting::PrefabTests|AutomatedTesting::TerrainTests_Main|Gem::EMotionFX.Editor.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", "TEST_RESULTS": "True" } }, @@ -96,7 +96,7 @@ "CMAKE_OPTIONS": "-G 'Ninja Multi-Config' -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 -DLY_UNITY_BUILD=FALSE -DLY_PARALLEL_LINK_JOBS=4", "CMAKE_LY_PROJECTS": "AutomatedTesting", "CMAKE_TARGET": "all", - "CTEST_OPTIONS": "-E (AutomatedTesting::Atom_TestSuite_Main|AutomatedTesting::PhysicsTests_Main|AutomatedTesting::PrefabTests|Gem::EMotionFX.Editor.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", + "CTEST_OPTIONS": "-E (AutomatedTesting::Atom_TestSuite_Main|AutomatedTesting::PhysicsTests_Main|AutomatedTesting::PrefabTests|AutomatedTesting::TerrainTests_Main|Gem::EMotionFX.Editor.Tests) -L (SUITE_smoke|SUITE_main) -LE (REQUIRES_gpu) --no-tests=error", "TEST_RESULTS": "True" } }, From ca66c609aaa8383be125997266128010197d5f66 Mon Sep 17 00:00:00 2001 From: lsemp3d <58790905+lsemp3d@users.noreply.github.com> Date: Mon, 15 Nov 2021 11:43:16 -0800 Subject: [PATCH 15/30] Added user setting to change the Script Canvas node palette context menu Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com> --- .../EditorContextMenu/EditorContextMenu.cpp | 5 +++++ .../EditorContextMenu/EditorContextMenu.h | 20 +++++++++---------- .../GraphCanvasAssetEditorMainWindow.cpp | 2 +- Gems/ScriptCanvas/Code/Editor/Settings.cpp | 9 ++++++--- Gems/ScriptCanvas/Code/Editor/Settings.h | 2 ++ .../View/Windows/ScriptCanvasContextMenus.cpp | 12 +++++++++++ 6 files changed, 36 insertions(+), 14 deletions(-) diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.cpp b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.cpp index a1e921684f..b3bf8f71d9 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.cpp +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.cpp @@ -119,6 +119,11 @@ namespace GraphCanvas m_nodePalette->setProperty("HasNoWindowDecorations", true); m_nodePalette->SetupNodePalette(config); + if (m_userNodePaletteWidth > 0.f) + { + m_nodePalette->setFixedWidth(m_userNodePaletteWidth); + } + QWidgetAction* actionWidget = new QWidgetAction(this); actionWidget->setDefaultWidget(m_nodePalette); diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.h b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.h index a942858f56..9831975a94 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.h +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.h @@ -63,34 +63,34 @@ namespace GraphCanvas void ResetSourceSlotFilter(); void FilterForSourceSlot(const GraphId& graphId, const AZ::EntityId& sourceSlotId); - protected slots: + protected Q_SLOTS: virtual void SetupDisplay(); virtual void HandleContextMenuSelection(); protected: + virtual void OnRefreshActions(const GraphId& graphId, const AZ::EntityId& targetMemberId); void keyPressEvent(QKeyEvent* keyEvent) override; - NodePaletteWidget* m_nodePalette = nullptr; - - private: - void ConstructMenu(); void AddUnprocessedActions(AZStd::vector& actions); - bool m_finalized; - bool m_isToolBarMenu; + NodePaletteWidget* m_nodePalette = nullptr; + + bool m_finalized; + bool m_isToolBarMenu; + float m_userNodePaletteWidth = 300.f; EditorId m_editorId; - AZStd::vector< ActionGroupId > m_actionGroupOrdering; - AZStd::unordered_set< ActionGroupId > m_actionGroups; + AZStd::vector m_actionGroupOrdering; + AZStd::unordered_set m_actionGroups; AZStd::vector m_unprocessedFrontActions; AZStd::vector m_unprocessedActions; AZStd::vector m_unprocessedBackActions; - AZStd::unordered_map< AZStd::string, QMenu* > m_subMenuMap; + AZStd::unordered_map m_subMenuMap; }; } diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasEditor/GraphCanvasAssetEditorMainWindow.cpp b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasEditor/GraphCanvasAssetEditorMainWindow.cpp index 13e4f5560f..3e14de48e7 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasEditor/GraphCanvasAssetEditorMainWindow.cpp +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasEditor/GraphCanvasAssetEditorMainWindow.cpp @@ -41,7 +41,7 @@ namespace GraphCanvas { // Default size percentage that the Node Palette dock widget will take up - static const float DEFAULT_NODE_PALETTE_SIZE = 0.15f; + static const float DEFAULT_NODE_PALETTE_SIZE = 0.25f; void AssetEditorUserSettings::Reflect(AZ::ReflectContext* context) { diff --git a/Gems/ScriptCanvas/Code/Editor/Settings.cpp b/Gems/ScriptCanvas/Code/Editor/Settings.cpp index fd745fa257..8d24a30aab 100644 --- a/Gems/ScriptCanvas/Code/Editor/Settings.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Settings.cpp @@ -395,6 +395,7 @@ namespace ScriptCanvasEditor ->Field("ShowUpgradeDialog", &ScriptCanvasEditorSettings::m_showUpgradeDialog) ->Field("ZoomSettings", &ScriptCanvasEditorSettings::m_zoomSettings) ->Field("ExperimentalSettings", &ScriptCanvasEditorSettings::m_experimentalSettings) + ->Field("SceneContextMenuNodePaletteWidth", &ScriptCanvasEditorSettings::m_sceneContextMenuNodePaletteWidth) ; AZ::EditContext* editContext = serialize->GetEditContext(); @@ -467,13 +468,13 @@ namespace ScriptCanvasEditor ->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20)) ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_snapDistance, "Connection Snap Distance", "The distance from a slot under which connections will snap to it.") ->Attribute(AZ::Edit::Attributes::Min, 10.0) - ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_enableGroupDoubleClickCollapse, "Double Click to Collapse/Uncollapse Group", "Enables the user to decide whether you can double click on a group to collapse/uncollapse a group.") + ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_enableGroupDoubleClickCollapse, "Double Click to Collapse/Expand Group", "Enables the user to decide whether you can double click on a group to collapse/expand a group.") ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_allowBookmarkViewpointControl, "Bookmark Zooming", "Will cause the bookmarks to force the viewport into the state determined by the bookmark type\nBookmark Anchors - The viewport that exists when the bookmark is created.\nNode Groups - The area the Node Group covers") ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_dragNodeCouplingConfig, "Node Coupling Configuration", "Controls for managing Node Coupling.\nNode Coupling is when you are dragging a node and leave it hovered over another Node, we will try to connect the sides you overlapped with each other.") ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_dragNodeSplicingConfig, "Drag Node Splicing Configuration", "Controls for managing Node Splicing on a Drag.\nNode Splicing on a Drag will let you drag a node onto a connection, and splice that node onto the specified connection.") ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_dropNodeSplicingConfig, "Drop Node Splicing Configuration", "Controls for managing Node Splicing on a Drag.\nNode Splicing on a drop will let you drop a node onto a connection from the Node Palette, and splice that node onto the specified connection.") ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_autoSaveConfig, "AutoSave Configuration", "Controls for managing Auto Saving.\nAuto Saving will occur after the specified time of inactivity on a graph.") - ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_shakeDespliceConfig, "Shake To Desplice", "Settings that controls various parameters of the Shake to Desplice feature") + ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_shakeDespliceConfig, "Shake To De-splice", "Settings that controls various parameters of the Shake to De-splice feature") ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_allowNodeNudging, "Allow Node Nudging", "Controls whether or not nodes will attempt to nudge each other out of the way under various interactions.") ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_alignmentTimeMS, "Alignment Time", "Controls the amount of time nodes will take to slide into place when performing alignment commands") ->Attribute(AZ::Edit::Attributes::Min, 0) @@ -485,8 +486,10 @@ namespace ScriptCanvasEditor ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_experimentalSettings, "Experimental Settings", "Settings that will control elements that are under development and may not work as expected") ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_saveRawTranslationOuputToFile, "Save Translation File", "Save out the raw result of translation for debug purposes") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &SettingsCpp::UpdateProcessingSettings) - ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_printAbstractCodeModel, "Print Abstract Modeld", "Print out the Abstract Code Model to the console at the end of parsing for debug purposes") + ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_printAbstractCodeModel, "Print Abstract Model", "Print out the Abstract Code Model to the console at the end of parsing for debug purposes") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &SettingsCpp::UpdateProcessingSettings) + ->DataElement(AZ::Edit::UIHandlers::Default, &ScriptCanvasEditorSettings::m_sceneContextMenuNodePaletteWidth, "Context Menu Width", "Allows you to configure the width of the context menu that opens on a Script Canvas graph") + ->Attribute(AZ::Edit::Attributes::Min, 120) ; editContext->Class("Experimental", "Settings for features under development that may not behave as expected yet.") diff --git a/Gems/ScriptCanvas/Code/Editor/Settings.h b/Gems/ScriptCanvas/Code/Editor/Settings.h index eefb7454c3..dee55f8272 100644 --- a/Gems/ScriptCanvas/Code/Editor/Settings.h +++ b/Gems/ScriptCanvas/Code/Editor/Settings.h @@ -357,6 +357,8 @@ namespace ScriptCanvasEditor AZ::u32 m_alignmentTimeMS; StylingSettings m_stylingSettings; + + AZ::u32 m_sceneContextMenuNodePaletteWidth = 300; }; } } diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp index e4a95d7d19..6402a24b3a 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp @@ -12,6 +12,8 @@ #include #include +#include + #include #include @@ -41,6 +43,8 @@ #include #include "ScriptCanvasContextMenus.h" +#include "Settings.h" + #include #include #include @@ -53,6 +57,7 @@ #include #include + namespace ScriptCanvasEditor { //////////////////////////// @@ -805,6 +810,13 @@ namespace ScriptCanvasEditor SceneContextMenu::SceneContextMenu(const NodePaletteModel& paletteModel, AzToolsFramework::AssetBrowser::AssetBrowserFilterModel* assetModel) : GraphCanvas::SceneContextMenu(ScriptCanvasEditor::AssetEditorId) { + + auto userSettings = AZ::UserSettings::CreateFind(AZ_CRC("ScriptCanvasPreviewSettings", 0x1c5a2965), AZ::UserSettings::CT_LOCAL); + if (userSettings) + { + m_userNodePaletteWidth = userSettings->m_sceneContextMenuNodePaletteWidth; + } + const bool inContextMenu = true; Widget::ScriptCanvasNodePaletteConfig paletteConfig(paletteModel, assetModel, inContextMenu); AddNodePaletteMenuAction(paletteConfig); From cffd93642ef8ddae3e68fde10f93097142fbfb5e Mon Sep 17 00:00:00 2001 From: lsemp3d <58790905+lsemp3d@users.noreply.github.com> Date: Mon, 15 Nov 2021 11:48:35 -0800 Subject: [PATCH 16/30] Reverted unnecessary change Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com> --- .../GraphCanvasEditor/GraphCanvasAssetEditorMainWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasEditor/GraphCanvasAssetEditorMainWindow.cpp b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasEditor/GraphCanvasAssetEditorMainWindow.cpp index 3e14de48e7..13e4f5560f 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasEditor/GraphCanvasAssetEditorMainWindow.cpp +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasEditor/GraphCanvasAssetEditorMainWindow.cpp @@ -41,7 +41,7 @@ namespace GraphCanvas { // Default size percentage that the Node Palette dock widget will take up - static const float DEFAULT_NODE_PALETTE_SIZE = 0.25f; + static const float DEFAULT_NODE_PALETTE_SIZE = 0.15f; void AssetEditorUserSettings::Reflect(AZ::ReflectContext* context) { From 0a801ffd783e91b550c48f6f218e69baef6785e7 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Mon, 15 Nov 2021 15:33:46 -0600 Subject: [PATCH 17/30] Finalizing temporary prefab helpers and test Signed-off-by: jckand-amzn --- .../DynVegUtils_TempPrefabCreationWorks.py | 53 ++++++++++--------- .../editor_dynveg_test_helper.py | 41 +++++++------- 2 files changed, 51 insertions(+), 43 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py index 6f0aace162..3aac745149 100644 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py @@ -10,18 +10,16 @@ def DynVegUtils_TempPrefabCreationWorks(): """ Summary: An existing level is opened. Each Prefab setup to be spawned by Dynamic Vegetation tests is created in memory and - validated against existing components/mesh assignments. A spawner is then created with the temporary prefabs to ensure - proper functionality with Dynamic Vegetation components. + validated against existing test slice components/mesh assignments. Expected Behavior: - Temporary prefabs contain the expected components/assets. Instances plant as expected in the assigned area. + Temporary prefabs contain the expected components/assets. Test Steps: 1) Open an existing level - 2) Create each of the necessary temporary prefabs, and validate the component/mesh setups - 3) Create a Vegetation Layer Spawner setup using the temporary prefabs as Prefab Instance Spawner types - 4) Create a surface to plant on and validate instance counts - 5) Verify expected instance counts + 2) Create each of the necessary temporary Mesh prefabs, and validate the component/mesh setups + 3) Create the necessary temporary PhysX Collider, and validate the component setup + 4) Report errors/asserts Note: - This test file must be called from the Open 3D Engine Editor command terminal @@ -33,12 +31,15 @@ def DynVegUtils_TempPrefabCreationWorks(): import os + import azlmbr.asset as asset + import azlmbr.bus as bus + import azlmbr.legacy.general as general import azlmbr.math as math from largeworlds.large_worlds_utils import editor_dynveg_test_helper as dynveg from editor_python_test_tools.utils import Report, Tracer from editor_python_test_tools.utils import TestHelper as helper - from editor_python_test_tools.prefab_utils import Prefab, PrefabInstance, get_prefab_file_path + from editor_python_test_tools.prefab_utils import PrefabInstance with Tracer() as error_tracer: # Create dictionary for prefab filenames and paths to create using helper function @@ -54,25 +55,29 @@ def DynVegUtils_TempPrefabCreationWorks(): helper.init_idle() helper.open_level("Prefab", "Base") - # 2) Create a Dynamic Vegetation surface in preparation of prefab creation - center_point = math.Vector3(0.0, 0.0, 0.0) - dynveg.create_surface_entity("Planting Surface", center_point, 128.0, 128.0, 1.0) - - # 3) Create each of the Mesh asset prefabs and validate that the prefab created successfully + # 2) Create each of the Mesh asset prefabs and validate that the prefab created successfully for prefab_filename, asset_path in mesh_prefabs.items(): - prefab_created = ( - f"Temporary {prefab_filename} prefab created successfully", - f"Failed to create temporary {prefab_filename} prefab" + mesh_prefab_created = ( + f"Temporary mesh prefab: {prefab_filename} created successfully", + f"Failed to create temporary mesh prefab: {prefab_filename}" ) prefab = dynveg.create_temp_mesh_prefab(asset_path, prefab_filename) - Report.result(prefab_created, helper.wait_for_condition(lambda: PrefabInstance.is_valid(prefab[1]), 3.0)) - - # 4) Assign the temp prefab to the prefab instance spawner, and validate the instance count - for prefab_filename in mesh_prefabs: - spawner_entity = dynveg.create_prefab_spawner("PrefabSpawner", center_point, 16.0, 16.0, 16.0, - get_prefab_file_path(get_prefab_file_path(prefab_filename))) - - # 5) Report errors/asserts + Report.result(mesh_prefab_created, helper.wait_for_condition(lambda: + PrefabInstance.is_valid(prefab[1]), 3.0)) + + # 3) Create temp PhysX Collider prefab and validate that the prefab created successfully + physx_prefab_filename = "CedarTree_Collision" + physx_collider_prefab_created = ( + f"Temporary mesh prefab: {physx_prefab_filename} created successfully", + f"Failed to create temporary mesh prefab: {physx_prefab_filename}" + ) + test_physx_mesh_asset_id = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", os.path.join( + "assets", "objects", "foliage", "cedar.pxmesh"), math.Uuid(), False) + dynveg.create_temp_physx_mesh_collider(test_physx_mesh_asset_id, "CedarTree_Collision") + Report.result(physx_collider_prefab_created, helper.wait_for_condition(lambda: + PrefabInstance.is_valid(prefab[1]), 3.0)) + + # 4) Report errors/asserts helper.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}") diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py index 3004038b7f..9840a4c5fd 100755 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py @@ -19,7 +19,7 @@ import azlmbr.paths sys.path.append(os.path.join(azlmbr.paths.projectroot, 'Gem', 'PythonTests')) import editor_python_test_tools.hydra_editor_utils as hydra -from editor_python_test_tools.editor_entity_utils import EditorEntity, EditorComponent +from editor_python_test_tools.editor_entity_utils import EditorEntity from editor_python_test_tools.prefab_utils import Prefab @@ -33,13 +33,33 @@ def create_temp_mesh_prefab(mesh_asset_path, prefab_filename): # Assign the specified mesh asset mesh_asset = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", mesh_asset_path, math.Uuid(), False) mesh_component.set_component_property_value("Controller|Configuration|Mesh Asset", mesh_asset) - assert mesh_component.get_component_property_value("Controller|Configuration|Mesh Asset"), \ + assert mesh_component.get_component_property_value("Controller|Configuration|Mesh Asset") == mesh_asset, \ "Failed to set Mesh asset" # Create and return the temporary/in-memory prefab temp_prefab = Prefab.create_prefab([root], prefab_filename) return temp_prefab +def create_temp_physx_mesh_collider(physx_mesh_id, prefab_filename): + # Create initial entity + root = EditorEntity.create_editor_entity(name=prefab_filename) + assert root.exists(), "Failed to create entity" + # Add PhysX Collider component + collider_component = root.add_component("PhysX Collider") + assert root.has_component("PhysX Collider") and collider_component.is_enabled(), \ + "Failed to add/activate PhysX Collider component" + # Set the Collider's Shape Configuration field to PhysicsAsset, and assign the specified PhysX Mesh asset + collider_component.set_component_property_value("Shape Configuration|Shape", 7) + assert collider_component.get_component_property_value("Shape Configuration|Shape") == 7, \ + "Failed to set Collider Shape to PhysicsAsset" + collider_component.set_component_property_value("Shape Configuration|Asset|PhysX Mesh", physx_mesh_id) + assert collider_component.get_component_property_value("Shape Configuration|Asset|PhysX Mesh") == physx_mesh_id, \ + "Failed to assign PhysX Mesh asset" + # Create and return the temporary/in-memory prefab + temp_prefab = Prefab.create_prefab([root], prefab_filename) + return temp_prefab + + def create_surface_entity(name, center_point, box_size_x, box_size_y, box_size_z): # Create a "flat surface" entity to use as a plantable vegetation surface surface_entity = hydra.Entity(name) @@ -71,23 +91,6 @@ def create_mesh_surface_entity_with_slopes(name, center_point, uniform_scale): return surface_entity -def create_prefab_spawner(name, center_point, box_size_x, box_size_y, box_size_z, prefab_asset_path): - # Create a vegetation area entity to use as our test vegetation spawner - spawner_entity = EditorEntity.create_editor_entity_at(center_point, name=name) - spawner_entity.add_components(["Vegetation Layer Spawner", "Box Shape", "Vegetation Asset List"]) - if spawner_entity.id.IsValid(): - print(f"'{spawner_entity.get_name()}' created") - spawner_entity.components[1].set_component_property_value("Box Shape|Box Configuration|Dimensions", - math.Vector3(box_size_x, box_size_y, box_size_z)) - - # Set the vegetation area to a Prefab spawner with a specific prefab asset selected - prefab_spawner = vegetation.PrefabInstanceSpawner() - prefab_spawner.SetPrefabAssetPath(prefab_asset_path) - descriptor = spawner_entity.components[2].get_component_property_value("Configuration|Embedded Assets|[0]") - descriptor.spawner = prefab_spawner - spawner_entity.components[2].set_component_property_value("Configuration|Embedded Assets|[0]", descriptor) - return spawner_entity - def create_empty_spawner(name, center_point, box_size_x, box_size_y, box_size_z): # Create a vegetation area entity to use as our test vegetation spawner spawner_entity = EditorEntity.create_editor_entity_at(center_point, name=name) From 327d4192f8943b3fcdd427257177df6f8d516222 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Mon, 15 Nov 2021 15:48:44 -0600 Subject: [PATCH 18/30] Enabling new optimized periodic test runner for DynamicVegetation tests Signed-off-by: jckand-amzn --- .../Gem/PythonTests/largeworlds/CMakeLists.txt | 15 ++++++++++++++- .../dyn_veg/TestSuite_Periodic_Optimized.py | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/largeworlds/CMakeLists.txt index c2123d683c..98801b49d6 100644 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/CMakeLists.txt @@ -24,7 +24,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ LargeWorlds ) - ly_add_pytest( NAME AutomatedTesting::DynamicVegetationTests_Periodic TEST_SERIAL @@ -39,6 +38,20 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ LargeWorlds ) + ly_add_pytest( + NAME AutomatedTesting::DynamicVegetationTests_Periodic_Optimized + TEST_SERIAL + TEST_SUITE periodic + PATH ${CMAKE_CURRENT_LIST_DIR}/dyn_veg/TestSuite_Periodic_Optimized.py + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.Assets + AutomatedTesting.GameLauncher + COMPONENT + LargeWorlds + ) + ly_add_pytest( NAME AutomatedTesting::DynamicVegetationTests_Main_Optimized TEST_SERIAL diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/TestSuite_Periodic_Optimized.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/TestSuite_Periodic_Optimized.py index 764d2dec75..8d298e970b 100644 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/TestSuite_Periodic_Optimized.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/TestSuite_Periodic_Optimized.py @@ -16,7 +16,8 @@ from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, E @pytest.mark.parametrize("launcher_platform", ['windows_editor']) @pytest.mark.parametrize("project", ["AutomatedTesting"]) class TestAutomation(EditorTestSuite): - global_extra_cmdline_args = [] + + global_extra_cmdline_args = ["-BatchMode", "-autotest_mode", "--regset=/Amazon/Preferences/EnablePrefabSystem=true"] class test_DynVegUtils_TempPrefabCreationWorks(EditorSharedTest): from .EditorScripts import DynVegUtils_TempPrefabCreationWorks as test_module From 35b4f6a5387cdf190df31a7d3735eee37a98e8af Mon Sep 17 00:00:00 2001 From: lsemp3d <58790905+lsemp3d@users.noreply.github.com> Date: Mon, 15 Nov 2021 14:46:38 -0800 Subject: [PATCH 19/30] Replaced float with AZ::u32 Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com> --- .../GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.cpp | 2 +- .../GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.cpp b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.cpp index b3bf8f71d9..854918ac19 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.cpp +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.cpp @@ -119,7 +119,7 @@ namespace GraphCanvas m_nodePalette->setProperty("HasNoWindowDecorations", true); m_nodePalette->SetupNodePalette(config); - if (m_userNodePaletteWidth > 0.f) + if (m_userNodePaletteWidth > 0) { m_nodePalette->setFixedWidth(m_userNodePaletteWidth); } diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.h b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.h index 9831975a94..08ee8cecbf 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.h +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/EditorContextMenu/EditorContextMenu.h @@ -80,7 +80,7 @@ namespace GraphCanvas bool m_finalized; bool m_isToolBarMenu; - float m_userNodePaletteWidth = 300.f; + AZ::u32 m_userNodePaletteWidth = 300; EditorId m_editorId; From 60f7ea54aa3eaadc4a709ecf331b30e7fda05e6b Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Mon, 15 Nov 2021 17:45:52 -0600 Subject: [PATCH 20/30] Reverting unintentional change to create_vegetation_area() helper Signed-off-by: jckand-amzn --- .../EditorScripts/DynVegUtils_TempPrefabCreationWorks.py | 3 +-- .../large_worlds_utils/editor_dynveg_test_helper.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py index 3aac745149..16a6c2eda6 100644 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py @@ -33,7 +33,6 @@ def DynVegUtils_TempPrefabCreationWorks(): import azlmbr.asset as asset import azlmbr.bus as bus - import azlmbr.legacy.general as general import azlmbr.math as math from largeworlds.large_worlds_utils import editor_dynveg_test_helper as dynveg @@ -73,7 +72,7 @@ def DynVegUtils_TempPrefabCreationWorks(): ) test_physx_mesh_asset_id = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", os.path.join( "assets", "objects", "foliage", "cedar.pxmesh"), math.Uuid(), False) - dynveg.create_temp_physx_mesh_collider(test_physx_mesh_asset_id, "CedarTree_Collision") + dynveg.create_temp_physx_mesh_collider(test_physx_mesh_asset_id, physx_prefab_filename) Report.result(physx_collider_prefab_created, helper.wait_for_condition(lambda: PrefabInstance.is_valid(prefab[1]), 3.0)) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py index 9840a4c5fd..d840628abc 100755 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py @@ -123,7 +123,7 @@ def create_vegetation_area(name, center_point, box_size_x, box_size_y, box_size_ # Set the vegetation area to a Dynamic Slice spawner with a specific slice asset selected dynamic_slice_spawner = vegetation.DynamicSliceInstanceSpawner() dynamic_slice_spawner.SetSliceAssetPath(dynamic_slice_asset_path) - descriptor = vegetation.Descriptor() + descriptor = hydra.get_component_property_value(spawner_entity.components[2], 'Configuration|Embedded Assets|[0]') descriptor.spawner = dynamic_slice_spawner spawner_entity.get_set_test(2, "Configuration|Embedded Assets|[0]", descriptor) return spawner_entity From 05caf1b29da517f188704337d5ec9fa452c242b0 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Mon, 15 Nov 2021 17:50:42 -0600 Subject: [PATCH 21/30] Removed redundant append to components list from add_component() Signed-off-by: jckand-amzn --- .../editor_python_test_tools/editor_entity_utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/editor_entity_utils.py b/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/editor_entity_utils.py index aee8846afe..59e454479c 100644 --- a/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/editor_entity_utils.py +++ b/AutomatedTesting/Gem/PythonTests/EditorPythonTestTools/editor_python_test_tools/editor_entity_utils.py @@ -259,7 +259,6 @@ class EditorEntity: :return: Component object of newly added component. """ component = self.add_components([component_name])[0] - self.components.append(component) return component def add_components(self, component_names: list) -> List[EditorComponent]: From e5ebdaebcf2452d1c10806a7c4cfb31f543ecd60 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Mon, 15 Nov 2021 18:27:52 -0600 Subject: [PATCH 22/30] Removing unused helper for now and utilizing helper function for opening base level Signed-off-by: jckand-amzn --- .../DynVegUtils_TempPrefabCreationWorks.py | 4 ++-- .../editor_dynveg_test_helper.py | 17 ----------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py index 16a6c2eda6..8d7f02425d 100644 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py @@ -35,6 +35,7 @@ def DynVegUtils_TempPrefabCreationWorks(): import azlmbr.bus as bus import azlmbr.math as math + from Prefab.tests import PrefabTestUtils as prefab_test_utils from largeworlds.large_worlds_utils import editor_dynveg_test_helper as dynveg from editor_python_test_tools.utils import Report, Tracer from editor_python_test_tools.utils import TestHelper as helper @@ -51,8 +52,7 @@ def DynVegUtils_TempPrefabCreationWorks(): } # 1) Open an existing simple level - helper.init_idle() - helper.open_level("Prefab", "Base") + prefab_test_utils.open_base_tests_level() # 2) Create each of the Mesh asset prefabs and validate that the prefab created successfully for prefab_filename, asset_path in mesh_prefabs.items(): diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py index d840628abc..d7d5842518 100755 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/large_worlds_utils/editor_dynveg_test_helper.py @@ -91,23 +91,6 @@ def create_mesh_surface_entity_with_slopes(name, center_point, uniform_scale): return surface_entity -def create_empty_spawner(name, center_point, box_size_x, box_size_y, box_size_z): - # Create a vegetation area entity to use as our test vegetation spawner - spawner_entity = EditorEntity.create_editor_entity_at(center_point, name=name) - spawner_entity.add_components(["Vegetation Layer Spawner", "Box Shape", "Vegetation Asset List"]) - if spawner_entity.id.IsValid(): - print(f"'{spawner_entity.get_name()}' created") - spawner_entity.components[1].set_component_property_value("Box Shape|Box Configuration|Dimensions", - math.Vector3(box_size_x, box_size_y, box_size_z)) - - # Set the vegetation area to an empty spawner - empty_spawner = vegetation.EmptyInstanceSpawner() - descriptor = spawner_entity.components[2].get_component_property_value("Configuration|Embedded Assets|[0]") - descriptor.spawner = empty_spawner - spawner_entity.components[2].set_component_property_value("Configuration|Embedded Assets|[0]", descriptor) - return spawner_entity - - def create_vegetation_area(name, center_point, box_size_x, box_size_y, box_size_z, dynamic_slice_asset_path): # Create a vegetation area entity to use as our test vegetation spawner spawner_entity = hydra.Entity(name) From d2d83079eb36d3620fcf67e383bdfb95f03e1339 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Mon, 15 Nov 2021 18:30:06 -0600 Subject: [PATCH 23/30] Cleaning up test docstring Signed-off-by: jckand-amzn --- .../EditorScripts/DynVegUtils_TempPrefabCreationWorks.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py index 8d7f02425d..d016473d5e 100644 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/DynVegUtils_TempPrefabCreationWorks.py @@ -21,11 +21,6 @@ def DynVegUtils_TempPrefabCreationWorks(): 3) Create the necessary temporary PhysX Collider, and validate the component setup 4) Report errors/asserts - Note: - - This test file must be called from the Open 3D Engine Editor command terminal - - Any passed and failed tests are written to the Editor.log file. - Parsing the file or running a log_monitor are required to observe the test results. - :return: None """ From 9a72dd7446a1ea5f94f1c8927031963fe94716cb Mon Sep 17 00:00:00 2001 From: Roman <69218254+amzn-rhhong@users.noreply.github.com> Date: Tue, 16 Nov 2021 00:17:40 -0800 Subject: [PATCH 24/30] Bugfix - Render normal is incomplete when multiple mesh present. (#5605) Signed-off-by: rhhong --- .../Code/Source/AtomActorDebugDraw.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorDebugDraw.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorDebugDraw.cpp index 50af91020a..89053f6349 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorDebugDraw.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorDebugDraw.cpp @@ -329,15 +329,15 @@ namespace AZ::Render m_auxVertices.emplace_back(position); m_auxVertices.emplace_back(position + normal); } - } - RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs; - lineArgs.m_verts = m_auxVertices.data(); - lineArgs.m_vertCount = static_cast(m_auxVertices.size()); - lineArgs.m_colors = &vertexNormalsColor; - lineArgs.m_colorCount = 1; - lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off; - auxGeom->DrawLines(lineArgs); + RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs; + lineArgs.m_verts = m_auxVertices.data(); + lineArgs.m_vertCount = static_cast(m_auxVertices.size()); + lineArgs.m_colors = &vertexNormalsColor; + lineArgs.m_colorCount = 1; + lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off; + auxGeom->DrawLines(lineArgs); + } } } From 84ba4afc54dc54dad85ee8406f635a8f9d0ae757 Mon Sep 17 00:00:00 2001 From: Benjamin Jillich <43751992+amzn-jillich@users.noreply.github.com> Date: Tue, 16 Nov 2021 12:45:02 +0100 Subject: [PATCH 25/30] EMotion FX: Deleting a corresponding anim graph when a Reference node is open crashes the Editor (#5612) Signed-off-by: Benjamin Jillich --- Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphReferenceNode.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphReferenceNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphReferenceNode.cpp index 16f192615d..00ff273187 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphReferenceNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphReferenceNode.cpp @@ -642,6 +642,8 @@ namespace EMotionFX void AnimGraphReferenceNode::OnAnimGraphAssetChanged() { + AnimGraphNotificationBus::Broadcast(&AnimGraphNotificationBus::Events::OnReferenceAnimGraphAboutToBeChanged, this); + ReleaseAnimGraphInstances(); AnimGraphNotificationBus::Broadcast(&AnimGraphNotificationBus::Events::OnReferenceAnimGraphChanged, this); From 83df48381345cf0b6aa31816cf14379ce0c74909 Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Tue, 16 Nov 2021 08:08:53 -0600 Subject: [PATCH 26/30] Updated splash screen and about dialog with Stable 21.11 name Signed-off-by: Chris Galvan --- Code/Editor/AboutDialog.ui | 2 +- Code/Editor/StartupLogoDialog.ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Editor/AboutDialog.ui b/Code/Editor/AboutDialog.ui index a6c5bb5d52..a36d65e35b 100644 --- a/Code/Editor/AboutDialog.ui +++ b/Code/Editor/AboutDialog.ui @@ -125,7 +125,7 @@ - General Availability + Stable 21.11 Qt::AutoText diff --git a/Code/Editor/StartupLogoDialog.ui b/Code/Editor/StartupLogoDialog.ui index c0b8115cb0..c2cbfcfd69 100644 --- a/Code/Editor/StartupLogoDialog.ui +++ b/Code/Editor/StartupLogoDialog.ui @@ -103,7 +103,7 @@ - General Availability + Stable 21.11 From 3428bcb5dad0fd628c07cd11d63c17ca36975dd4 Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Tue, 16 Nov 2021 10:07:45 -0600 Subject: [PATCH 27/30] Updated splash screen and about dialog with development name Signed-off-by: Chris Galvan --- Code/Editor/AboutDialog.ui | 2 +- Code/Editor/StartupLogoDialog.ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Editor/AboutDialog.ui b/Code/Editor/AboutDialog.ui index a36d65e35b..09a7c18841 100644 --- a/Code/Editor/AboutDialog.ui +++ b/Code/Editor/AboutDialog.ui @@ -125,7 +125,7 @@ - Stable 21.11 + development Qt::AutoText diff --git a/Code/Editor/StartupLogoDialog.ui b/Code/Editor/StartupLogoDialog.ui index c2cbfcfd69..cbc596f53a 100644 --- a/Code/Editor/StartupLogoDialog.ui +++ b/Code/Editor/StartupLogoDialog.ui @@ -103,7 +103,7 @@ - Stable 21.11 + development From a1c67a52033250d8cae8c4e71037266e28dc1a55 Mon Sep 17 00:00:00 2001 From: chiyenteng <82238204+chiyenteng@users.noreply.github.com> Date: Tue, 16 Nov 2021 09:56:24 -0800 Subject: [PATCH 28/30] Fix prefab enabled automated tests (#5626) Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com> --- .../Gem/PythonTests/Physics/TestSuite_Main_Optimized.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AutomatedTesting/Gem/PythonTests/Physics/TestSuite_Main_Optimized.py b/AutomatedTesting/Gem/PythonTests/Physics/TestSuite_Main_Optimized.py index 3d668a2085..0661c6742b 100644 --- a/AutomatedTesting/Gem/PythonTests/Physics/TestSuite_Main_Optimized.py +++ b/AutomatedTesting/Gem/PythonTests/Physics/TestSuite_Main_Optimized.py @@ -60,7 +60,7 @@ class EditorSingleTest_WithFileOverrides(EditorSingleTest): class TestAutomationWithPrefabSystemEnabled(EditorTestSuite): global_extra_cmdline_args = ['-BatchMode', '-autotest_mode', - 'extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]'] + '--regset=/Amazon/Preferences/EnablePrefabSystem=true'] @staticmethod def get_number_parallel_editors(): From 59b12a6ec7e8e2bce2c6a2669fc71bca6fd673ce Mon Sep 17 00:00:00 2001 From: Vincent Liu <5900509+onecent1101@users.noreply.github.com> Date: Tue, 16 Nov 2021 12:14:05 -0800 Subject: [PATCH 29/30] Add cvar for aws log level (#5507) * Add cvar for aws log level Signed-off-by: onecent1101 * Remove old crysystem registered cmd and add safeguard to get cvar from console Signed-off-by: onecent1101 * Suppress error for client auth unit test as logging was routed to warning before Signed-off-by: onecent1101 --- Code/Legacy/CrySystem/SystemInit.cpp | 16 -- Code/Tools/AWSNativeSDKInit/CMakeLists.txt | 27 +++ .../aws_native_sdk_init_tests_files.cmake | 12 ++ .../source/AWSLogSystemInterface.cpp | 26 +-- .../source/AWSNativeSDKInit.cpp | 4 +- .../tests/AWSLogSystemInterfaceTest.cpp | 169 ++++++++++++++++++ .../tests/AWSNativeSDKInitTest.cpp | 11 ++ .../AWSCognitoAuthorizationControllerTest.cpp | 6 + .../Code/AWSGameLiftClient/CMakeLists.txt | 2 - .../Source/AWSGameLiftClientManager.cpp | 4 +- 10 files changed, 244 insertions(+), 33 deletions(-) create mode 100644 Code/Tools/AWSNativeSDKInit/aws_native_sdk_init_tests_files.cmake create mode 100644 Code/Tools/AWSNativeSDKInit/tests/AWSLogSystemInterfaceTest.cpp create mode 100644 Code/Tools/AWSNativeSDKInit/tests/AWSNativeSDKInitTest.cpp diff --git a/Code/Legacy/CrySystem/SystemInit.cpp b/Code/Legacy/CrySystem/SystemInit.cpp index 8a0586fb13..5cb60f2cdf 100644 --- a/Code/Legacy/CrySystem/SystemInit.cpp +++ b/Code/Legacy/CrySystem/SystemInit.cpp @@ -1225,20 +1225,6 @@ static AZStd::string ConcatPath(const char* szPart1, const char* szPart2) return ret; } -// Helper to maintain backwards compatibility with our CVar but not force our new code to -// pull in CryCommon by routing through an environment variable -void CmdSetAwsLogLevel(IConsoleCmdArgs* pArgs) -{ - static const char* const logLevelEnvVar = "sys_SetLogLevel"; - static AZ::EnvironmentVariable logVar = AZ::Environment::CreateVariable(logLevelEnvVar); - if (pArgs->GetArgCount() > 1) - { - int logLevel = atoi(pArgs->GetArg(1)); - *logVar = logLevel; - AZ_TracePrintf("AWSLogging", "Log level set to %d", *logVar); - } -} - ////////////////////////////////////////////////////////////////////////// void CSystem::CreateSystemVars() { @@ -1601,8 +1587,6 @@ void CSystem::CreateSystemVars() // Since the UI Canvas Editor is incomplete, we have a variable to enable it. // By default it is now enabled. Modify system.cfg or game.cfg to disable it REGISTER_INT("sys_enableCanvasEditor", 1, VF_NULL, "Enables the UI Canvas Editor"); - - REGISTER_COMMAND("sys_SetLogLevel", CmdSetAwsLogLevel, 0, "Set AWS log level [0 - 6]."); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Tools/AWSNativeSDKInit/CMakeLists.txt b/Code/Tools/AWSNativeSDKInit/CMakeLists.txt index d571f0d9e3..57ee31d30d 100644 --- a/Code/Tools/AWSNativeSDKInit/CMakeLists.txt +++ b/Code/Tools/AWSNativeSDKInit/CMakeLists.txt @@ -24,3 +24,30 @@ ly_add_target( 3rdParty::AWSNativeSDK::Core AZ::AzCore ) + +################################################################################ +# Tests +################################################################################ +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) + ly_add_target( + NAME AWSNativeSDKInit.Tests ${PAL_TRAIT_TEST_TARGET_TYPE} + NAMESPACE AZ + FILES_CMAKE + aws_native_sdk_init_tests_files.cmake + INCLUDE_DIRECTORIES + PRIVATE + include + tests + source + BUILD_DEPENDENCIES + PRIVATE + AZ::AzCore + AZ::AzFramework + AZ::AzTest + AZ::AWSNativeSDKInit + 3rdParty::AWSNativeSDK::Core + ) + ly_add_googletest( + NAME AZ::AWSNativeSDKInit.Tests + ) +endif() diff --git a/Code/Tools/AWSNativeSDKInit/aws_native_sdk_init_tests_files.cmake b/Code/Tools/AWSNativeSDKInit/aws_native_sdk_init_tests_files.cmake new file mode 100644 index 0000000000..9029a1198a --- /dev/null +++ b/Code/Tools/AWSNativeSDKInit/aws_native_sdk_init_tests_files.cmake @@ -0,0 +1,12 @@ +# +# 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 +# +# + +set(FILES + tests/AWSLogSystemInterfaceTest.cpp + tests/AWSNativeSDKInitTest.cpp +) diff --git a/Code/Tools/AWSNativeSDKInit/source/AWSLogSystemInterface.cpp b/Code/Tools/AWSNativeSDKInit/source/AWSLogSystemInterface.cpp index 113e513743..0ccfc43ba4 100644 --- a/Code/Tools/AWSNativeSDKInit/source/AWSLogSystemInterface.cpp +++ b/Code/Tools/AWSNativeSDKInit/source/AWSLogSystemInterface.cpp @@ -10,6 +10,8 @@ #include #include +#include +#include #include #include @@ -24,6 +26,9 @@ AZ_POP_DISABLE_WARNING namespace AWSNativeSDKInit { + AZ_CVAR(int, bg_awsLogLevel, -1, nullptr, AZ::ConsoleFunctorFlags::Null, + "AWSLogLevel used to control verbosity of logging system. Off = 0, Fatal = 1, Error = 2, Warn = 3, Info = 4, Debug = 5, Trace = 6"); + const char* AWSLogSystemInterface::AWS_API_LOG_PREFIX = "AwsApi-"; const int AWSLogSystemInterface::MAX_MESSAGE_LENGTH = 4096; const char* AWSLogSystemInterface::MESSAGE_FORMAT = "[AWS] %s - %s"; @@ -40,15 +45,16 @@ namespace AWSNativeSDKInit Aws::Utils::Logging::LogLevel AWSLogSystemInterface::GetLogLevel() const { Aws::Utils::Logging::LogLevel newLevel = m_logLevel; - static const char* const logLevelEnvVar = "sys_SetLogLevel"; - auto logVar = AZ::Environment::FindVariable(logLevelEnvVar); - - if (logVar) + if (auto console = AZ::Interface::Get(); console != nullptr) { - newLevel = (Aws::Utils::Logging::LogLevel) *logVar; + int awsLogLevel = -1; + console->GetCvarValue("bg_awsLogLevel", awsLogLevel); + if (awsLogLevel >= 0) + { + newLevel = static_cast(awsLogLevel); + } } - - return newLevel != m_logLevel ? newLevel : m_logLevel; + return newLevel; } /** @@ -78,14 +84,12 @@ namespace AWSNativeSDKInit */ void AWSLogSystemInterface::LogStream(Aws::Utils::Logging::LogLevel logLevel, const char* tag, const Aws::OStringStream &messageStream) { - if(!ShouldLog(logLevel)) { return; } ForwardAwsApiLogMessage(logLevel, tag, messageStream.str().c_str()); - } bool AWSLogSystemInterface::ShouldLog(Aws::Utils::Logging::LogLevel logLevel) @@ -93,7 +97,7 @@ namespace AWSNativeSDKInit #if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK) Aws::Utils::Logging::LogLevel newLevel = GetLogLevel(); - if (newLevel > Aws::Utils::Logging::LogLevel::Info && newLevel <= Aws::Utils::Logging::LogLevel::Trace && newLevel != m_logLevel) + if (newLevel != m_logLevel) { SetLogLevel(newLevel); } @@ -124,7 +128,7 @@ namespace AWSNativeSDKInit break; case Aws::Utils::Logging::LogLevel::Error: - AZ::Debug::Trace::Instance().Warning(__FILE__, __LINE__, AZ_FUNCTION_SIGNATURE, AWSLogSystemInterface::ERROR_WINDOW_NAME, MESSAGE_FORMAT, tag, message); + AZ::Debug::Trace::Instance().Error(__FILE__, __LINE__, AZ_FUNCTION_SIGNATURE, AWSLogSystemInterface::ERROR_WINDOW_NAME, MESSAGE_FORMAT, tag, message); break; case Aws::Utils::Logging::LogLevel::Warn: diff --git a/Code/Tools/AWSNativeSDKInit/source/AWSNativeSDKInit.cpp b/Code/Tools/AWSNativeSDKInit/source/AWSNativeSDKInit.cpp index 815fc1bbf0..ca63859945 100644 --- a/Code/Tools/AWSNativeSDKInit/source/AWSNativeSDKInit.cpp +++ b/Code/Tools/AWSNativeSDKInit/source/AWSNativeSDKInit.cpp @@ -64,10 +64,10 @@ namespace AWSNativeSDKInit { #if defined(PLATFORM_SUPPORTS_AWS_NATIVE_SDK) Aws::Utils::Logging::LogLevel logLevel; -#ifdef _DEBUG +#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD) logLevel = Aws::Utils::Logging::LogLevel::Warn; #else - logLevel = Aws::Utils::Logging::LogLevel::Warn; + logLevel = Aws::Utils::Logging::LogLevel::Error; #endif m_awsSDKOptions.loggingOptions.logLevel = logLevel; m_awsSDKOptions.loggingOptions.logger_create_fn = [logLevel]() diff --git a/Code/Tools/AWSNativeSDKInit/tests/AWSLogSystemInterfaceTest.cpp b/Code/Tools/AWSNativeSDKInit/tests/AWSLogSystemInterfaceTest.cpp new file mode 100644 index 0000000000..02b6cbebc1 --- /dev/null +++ b/Code/Tools/AWSNativeSDKInit/tests/AWSLogSystemInterfaceTest.cpp @@ -0,0 +1,169 @@ +/* + * 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 + * + */ + +#include +#include +#include +#include +#include + +#include + +#include + +using namespace AWSNativeSDKInit; + +class AWSLogSystemInterfaceTest + : public UnitTest::ScopedAllocatorSetupFixture + , public AZ::Debug::TraceMessageBus::Handler +{ +public: + bool OnPreAssert(const char*, int, const char*, const char*) override + { + return true; + } + + bool OnPreError(const char*, const char*, int, const char*, const char*) override + { + m_error = true; + return true; + } + + bool OnPreWarning(const char*, const char*, int, const char*, const char*) override + { + m_warning = true; + return true; + } + + bool OnPrintf(const char*, const char*) override + { + m_printf = true; + return true; + } + + void SetUp() override + { + BusConnect(); + if (!AZ::Interface::Get()) + { + m_console = AZStd::make_unique(); + m_console->LinkDeferredFunctors(AZ::ConsoleFunctorBase::GetDeferredHead()); + AZ::Interface::Register(m_console.get()); + } + } + + void TearDown() override + { + if (m_console) + { + AZ::Interface::Unregister(m_console.get()); + m_console.reset(); + } + BusDisconnect(); + } + + bool m_error = false; + bool m_warning = false; + bool m_printf = false; + +private: + AZStd::unique_ptr m_console; +}; + +TEST_F(AWSLogSystemInterfaceTest, LogStream_LogFatalMessage_GetExpectedNotification) +{ + AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace); + Aws::OStringStream testString; + logSystem.LogStream(Aws::Utils::Logging::LogLevel::Fatal, "test", testString); + ASSERT_TRUE(m_error); + ASSERT_FALSE(m_warning); + ASSERT_FALSE(m_printf); +} + +TEST_F(AWSLogSystemInterfaceTest, LogStream_LogErrorMessage_GetExpectedNotification) +{ + AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace); + Aws::OStringStream testString; + logSystem.LogStream(Aws::Utils::Logging::LogLevel::Error, "test", testString); + ASSERT_TRUE(m_error); + ASSERT_FALSE(m_warning); + ASSERT_FALSE(m_printf); +} + +TEST_F(AWSLogSystemInterfaceTest, LogStream_LogWarningMessage_GetExpectedNotification) +{ + AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace); + Aws::OStringStream testString; + logSystem.LogStream(Aws::Utils::Logging::LogLevel::Warn, "test", testString); + ASSERT_FALSE(m_error); + ASSERT_TRUE(m_warning); + ASSERT_FALSE(m_printf); +} + +TEST_F(AWSLogSystemInterfaceTest, LogStream_LogInfoMessage_GetExpectedNotification) +{ + AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace); + Aws::OStringStream testString; + logSystem.LogStream(Aws::Utils::Logging::LogLevel::Info, "test", testString); + ASSERT_FALSE(m_error); + ASSERT_FALSE(m_warning); + ASSERT_TRUE(m_printf); +} + +TEST_F(AWSLogSystemInterfaceTest, LogStream_LogDebugMessage_GetExpectedNotification) +{ + AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace); + Aws::OStringStream testString; + logSystem.LogStream(Aws::Utils::Logging::LogLevel::Debug, "test", testString); + ASSERT_FALSE(m_error); + ASSERT_FALSE(m_warning); + ASSERT_TRUE(m_printf); +} + +TEST_F(AWSLogSystemInterfaceTest, LogStream_LogTraceMessage_GetExpectedNotification) +{ + AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace); + Aws::OStringStream testString; + logSystem.LogStream(Aws::Utils::Logging::LogLevel::Trace, "test", testString); + ASSERT_FALSE(m_error); + ASSERT_FALSE(m_warning); + ASSERT_TRUE(m_printf); +} + +TEST_F(AWSLogSystemInterfaceTest, LogStream_OverrideWarnAndLogInfoMessage_GetExpectedNotification) +{ + AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace); + Aws::OStringStream testString; + AZ::Interface::Get()->PerformCommand("bg_awsLogLevel 3"); + logSystem.LogStream(Aws::Utils::Logging::LogLevel::Info, "test", testString); + ASSERT_FALSE(m_error); + ASSERT_FALSE(m_warning); + ASSERT_FALSE(m_printf); +} + +TEST_F(AWSLogSystemInterfaceTest, LogStream_OverrideWarnAndLogeErrorMessage_GetExpectedNotification) +{ + AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace); + Aws::OStringStream testString; + AZ::Interface::Get()->PerformCommand("bg_awsLogLevel 3"); + logSystem.LogStream(Aws::Utils::Logging::LogLevel::Error, "test", testString); + ASSERT_TRUE(m_error); + ASSERT_FALSE(m_warning); + ASSERT_FALSE(m_printf); +} + +TEST_F(AWSLogSystemInterfaceTest, LogStream_OverrideOffAndLogInfoMessage_GetExpectedNotification) +{ + AWSLogSystemInterface logSystem(Aws::Utils::Logging::LogLevel::Trace); + Aws::OStringStream testString; + AZ::Interface::Get()->PerformCommand("bg_awsLogLevel 0"); + logSystem.LogStream(Aws::Utils::Logging::LogLevel::Info, "test", testString); + ASSERT_FALSE(m_error); + ASSERT_FALSE(m_warning); + ASSERT_FALSE(m_printf); +} diff --git a/Code/Tools/AWSNativeSDKInit/tests/AWSNativeSDKInitTest.cpp b/Code/Tools/AWSNativeSDKInit/tests/AWSNativeSDKInitTest.cpp new file mode 100644 index 0000000000..40217ff9bc --- /dev/null +++ b/Code/Tools/AWSNativeSDKInit/tests/AWSNativeSDKInitTest.cpp @@ -0,0 +1,11 @@ +/* + * 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 + * + */ + +#include + +AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV); diff --git a/Gems/AWSClientAuth/Code/Tests/Authorization/AWSCognitoAuthorizationControllerTest.cpp b/Gems/AWSClientAuth/Code/Tests/Authorization/AWSCognitoAuthorizationControllerTest.cpp index 9f31891512..2269a2340a 100644 --- a/Gems/AWSClientAuth/Code/Tests/Authorization/AWSCognitoAuthorizationControllerTest.cpp +++ b/Gems/AWSClientAuth/Code/Tests/Authorization/AWSCognitoAuthorizationControllerTest.cpp @@ -140,7 +140,9 @@ TEST_F(AWSCognitoAuthorizationControllerTest, RequestAWSCredentials_Fail_GetIdEr EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(0); EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsSuccess(testing::_)).Times(0); EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsFail(testing::_)).Times(1); + AZ_TEST_START_TRACE_SUPPRESSION; m_mockController->RequestAWSCredentialsAsync(); + AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; } TEST_F(AWSCognitoAuthorizationControllerTest, RequestAWSCredentials_Fail_GetCredentialsForIdentityError) @@ -174,7 +176,9 @@ TEST_F(AWSCognitoAuthorizationControllerTest, RequestAWSCredentials_Fail_GetCred EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(1).WillOnce(testing::Return(outcome)); EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsSuccess(testing::_)).Times(0); EXPECT_CALL(m_awsCognitoAuthorizationNotificationsBusMock, OnRequestAWSCredentialsFail(testing::_)).Times(1); + AZ_TEST_START_TRACE_SUPPRESSION; m_mockController->RequestAWSCredentialsAsync(); + AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; } TEST_F(AWSCognitoAuthorizationControllerTest, AddRemoveLogins_Succuess) @@ -331,8 +335,10 @@ TEST_F(AWSCognitoAuthorizationControllerTest, GetCredentialsProvider_NoPersisted EXPECT_CALL(*m_cognitoIdentityClientMock, GetCredentialsForIdentity(testing::_)).Times(0); std::shared_ptr actualCredentialsProvider; + AZ_TEST_START_TRACE_SUPPRESSION; AWSCore::AWSCredentialRequestBus::BroadcastResult( actualCredentialsProvider, &AWSCore::AWSCredentialRequests::GetCredentialsProvider); + AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; EXPECT_TRUE(actualCredentialsProvider == nullptr); } diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/CMakeLists.txt b/Gems/AWSGameLift/Code/AWSGameLiftClient/CMakeLists.txt index 1fab09e9f4..ab85e89f75 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/CMakeLists.txt +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/CMakeLists.txt @@ -6,8 +6,6 @@ # # -set(awsgameliftclient_compile_definition $,AWSGAMELIFT_RELEASE,AWSGAMELIFT_DEV>) - ly_add_target( NAME AWSGameLift.Client.Static STATIC NAMESPACE Gem diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.cpp index 4ee2d31ebf..a071b8f859 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.cpp @@ -33,7 +33,7 @@ namespace AWSGameLift { -#if defined(AWSGAMELIFT_DEV) +#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD) AZ_CVAR(AZ::CVarFixedString, cl_gameliftLocalEndpoint, "", nullptr, AZ::ConsoleFunctorFlags::Null, "The local endpoint to test with GameLiftLocal SDK."); #endif @@ -87,7 +87,7 @@ namespace AWSGameLift // Set up client endpoint or region AZStd::string localEndpoint = ""; -#if defined(AWSGAMELIFT_DEV) +#if defined(AZ_DEBUG_BUILD) || defined(AZ_PROFILE_BUILD) localEndpoint = static_cast(cl_gameliftLocalEndpoint); #endif if (!localEndpoint.empty()) From 8ca5a79076c349faef31b26423d4c4c1c11dd769 Mon Sep 17 00:00:00 2001 From: Vincent Liu <5900509+onecent1101@users.noreply.github.com> Date: Tue, 16 Nov 2021 13:06:59 -0800 Subject: [PATCH 30/30] Move gamelift client usage into each activity scope (#5554) Signed-off-by: onecent1101 --- .../Source/AWSGameLiftClientManager.cpp | 155 +++--------------- .../Source/AWSGameLiftClientManager.h | 9 - .../AWSGameLiftAcceptMatchActivity.cpp | 14 +- .../Activity/AWSGameLiftAcceptMatchActivity.h | 2 +- .../AWSGameLiftCreateSessionActivity.cpp | 23 ++- .../AWSGameLiftCreateSessionActivity.h | 6 +- ...WSGameLiftCreateSessionOnQueueActivity.cpp | 23 ++- .../AWSGameLiftCreateSessionOnQueueActivity.h | 6 +- .../AWSGameLiftJoinSessionActivity.cpp | 15 +- .../Activity/AWSGameLiftJoinSessionActivity.h | 1 - .../AWSGameLiftLeaveSessionActivity.cpp | 5 +- .../AWSGameLiftSearchSessionsActivity.cpp | 19 ++- .../AWSGameLiftSearchSessionsActivity.h | 3 - .../AWSGameLiftStartMatchmakingActivity.cpp | 15 +- .../AWSGameLiftStartMatchmakingActivity.h | 2 +- .../AWSGameLiftStopMatchmakingActivity.cpp | 14 +- .../AWSGameLiftStopMatchmakingActivity.h | 2 +- .../AWSGameLiftCreateSessionActivityTest.cpp | 2 + ...meLiftCreateSessionOnQueueActivityTest.cpp | 2 + .../AWSGameLiftJoinSessionActivityTest.cpp | 2 + .../AWSGameLiftSearchSessionsActivityTest.cpp | 3 + 21 files changed, 139 insertions(+), 184 deletions(-) diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.cpp index a071b8f859..f900310078 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.cpp @@ -139,7 +139,7 @@ namespace AWSGameLift { const AWSGameLiftAcceptMatchRequest& gameliftStartMatchmakingRequest = static_cast(acceptMatchRequest); - AcceptMatchHelper(gameliftStartMatchmakingRequest); + AcceptMatchActivity::AcceptMatch(gameliftStartMatchmakingRequest); } } @@ -157,9 +157,9 @@ namespace AWSGameLift AZ::JobContext* jobContext = nullptr; AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext); AZ::Job* acceptMatchJob = AZ::CreateJobFunction( - [this, gameliftStartMatchmakingRequest]() + [gameliftStartMatchmakingRequest]() { - AcceptMatchHelper(gameliftStartMatchmakingRequest); + AcceptMatchActivity::AcceptMatch(gameliftStartMatchmakingRequest); AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast( &AzFramework::MatchmakingAsyncRequestNotifications::OnAcceptMatchAsyncComplete); @@ -169,21 +169,6 @@ namespace AWSGameLift acceptMatchJob->Start(); } - void AWSGameLiftClientManager::AcceptMatchHelper(const AWSGameLiftAcceptMatchRequest& acceptMatchRequest) - { - auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); - - AZStd::string response; - if (!gameliftClient) - { - AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage); - } - else - { - AcceptMatchActivity::AcceptMatch(*gameliftClient, acceptMatchRequest); - } - } - AZStd::string AWSGameLiftClientManager::CreateSession(const AzFramework::CreateSessionRequest& createSessionRequest) { AZStd::string result = ""; @@ -191,13 +176,13 @@ namespace AWSGameLift { const AWSGameLiftCreateSessionRequest& gameliftCreateSessionRequest = static_cast(createSessionRequest); - result = CreateSessionHelper(gameliftCreateSessionRequest); + result = CreateSessionActivity::CreateSession(gameliftCreateSessionRequest); } else if (CreateSessionOnQueueActivity::ValidateCreateSessionOnQueueRequest(createSessionRequest)) { const AWSGameLiftCreateSessionOnQueueRequest& gameliftCreateSessionOnQueueRequest = static_cast(createSessionRequest); - result = CreateSessionOnQueueHelper(gameliftCreateSessionOnQueueRequest); + result = CreateSessionOnQueueActivity::CreateSessionOnQueue(gameliftCreateSessionOnQueueRequest); } else { @@ -217,9 +202,9 @@ namespace AWSGameLift AZ::JobContext* jobContext = nullptr; AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext); AZ::Job* createSessionJob = AZ::CreateJobFunction( - [this, gameliftCreateSessionRequest]() + [gameliftCreateSessionRequest]() { - AZStd::string result = CreateSessionHelper(gameliftCreateSessionRequest); + AZStd::string result = CreateSessionActivity::CreateSession(gameliftCreateSessionRequest); AzFramework::SessionAsyncRequestNotificationBus::Broadcast( &AzFramework::SessionAsyncRequestNotifications::OnCreateSessionAsyncComplete, result); @@ -235,9 +220,9 @@ namespace AWSGameLift AZ::JobContext* jobContext = nullptr; AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext); AZ::Job* createSessionOnQueueJob = AZ::CreateJobFunction( - [this, gameliftCreateSessionOnQueueRequest]() + [gameliftCreateSessionOnQueueRequest]() { - AZStd::string result = CreateSessionOnQueueHelper(gameliftCreateSessionOnQueueRequest); + AZStd::string result = CreateSessionOnQueueActivity::CreateSessionOnQueue(gameliftCreateSessionOnQueueRequest); AzFramework::SessionAsyncRequestNotificationBus::Broadcast( &AzFramework::SessionAsyncRequestNotifications::OnCreateSessionAsyncComplete, result); @@ -253,38 +238,6 @@ namespace AWSGameLift } } - AZStd::string AWSGameLiftClientManager::CreateSessionHelper( - const AWSGameLiftCreateSessionRequest& createSessionRequest) - { - auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); - AZStd::string result = ""; - if (!gameliftClient) - { - AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage); - } - else - { - result = CreateSessionActivity::CreateSession(*gameliftClient, createSessionRequest); - } - return result; - } - - AZStd::string AWSGameLiftClientManager::CreateSessionOnQueueHelper( - const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest) - { - auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); - AZStd::string result; - if (!gameliftClient) - { - AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage); - } - else - { - result = CreateSessionOnQueueActivity::CreateSessionOnQueue(*gameliftClient, createSessionOnQueueRequest); - } - return result; - } - bool AWSGameLiftClientManager::JoinSession(const AzFramework::JoinSessionRequest& joinSessionRequest) { bool result = false; @@ -292,7 +245,8 @@ namespace AWSGameLift { const AWSGameLiftJoinSessionRequest& gameliftJoinSessionRequest = static_cast(joinSessionRequest); - result = JoinSessionHelper(gameliftJoinSessionRequest); + auto createPlayerSessionOutcome = JoinSessionActivity::CreatePlayerSession(gameliftJoinSessionRequest); + result = JoinSessionActivity::RequestPlayerJoinSession(createPlayerSessionOutcome); } return result; @@ -313,9 +267,10 @@ namespace AWSGameLift AZ::JobContext* jobContext = nullptr; AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext); AZ::Job* joinSessionJob = AZ::CreateJobFunction( - [this, gameliftJoinSessionRequest]() + [gameliftJoinSessionRequest]() { - bool result = JoinSessionHelper(gameliftJoinSessionRequest); + auto createPlayerSessionOutcome = JoinSessionActivity::CreatePlayerSession(gameliftJoinSessionRequest); + bool result = JoinSessionActivity::RequestPlayerJoinSession(createPlayerSessionOutcome); AzFramework::SessionAsyncRequestNotificationBus::Broadcast( &AzFramework::SessionAsyncRequestNotifications::OnJoinSessionAsyncComplete, result); @@ -325,23 +280,6 @@ namespace AWSGameLift joinSessionJob->Start(); } - bool AWSGameLiftClientManager::JoinSessionHelper(const AWSGameLiftJoinSessionRequest& joinSessionRequest) - { - auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); - bool result = false; - if (!gameliftClient) - { - AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage); - } - else - { - auto createPlayerSessionOutcome = JoinSessionActivity::CreatePlayerSession(*gameliftClient, joinSessionRequest); - - result = JoinSessionActivity::RequestPlayerJoinSession(createPlayerSessionOutcome); - } - return result; - } - void AWSGameLiftClientManager::LeaveSession() { AWSGameLift::LeaveSessionActivity::LeaveSession(); @@ -371,7 +309,7 @@ namespace AWSGameLift { const AWSGameLiftSearchSessionsRequest& gameliftSearchSessionsRequest = static_cast(searchSessionsRequest); - response = SearchSessionsHelper(gameliftSearchSessionsRequest); + response = SearchSessionsActivity::SearchSessions(gameliftSearchSessionsRequest); } return response; @@ -392,9 +330,9 @@ namespace AWSGameLift AZ::JobContext* jobContext = nullptr; AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext); AZ::Job* searchSessionsJob = AZ::CreateJobFunction( - [this, gameliftSearchSessionsRequest]() + [gameliftSearchSessionsRequest]() { - AzFramework::SearchSessionsResponse response = SearchSessionsHelper(gameliftSearchSessionsRequest); + AzFramework::SearchSessionsResponse response = SearchSessionsActivity::SearchSessions(gameliftSearchSessionsRequest); AzFramework::SessionAsyncRequestNotificationBus::Broadcast( &AzFramework::SessionAsyncRequestNotifications::OnSearchSessionsAsyncComplete, response); @@ -404,22 +342,6 @@ namespace AWSGameLift searchSessionsJob->Start(); } - AzFramework::SearchSessionsResponse AWSGameLiftClientManager::SearchSessionsHelper( - const AWSGameLiftSearchSessionsRequest& searchSessionsRequest) const - { - auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); - AzFramework::SearchSessionsResponse response; - if (!gameliftClient) - { - AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage); - } - else - { - response = SearchSessionsActivity::SearchSessions(*gameliftClient, searchSessionsRequest); - } - return response; - } - AZStd::string AWSGameLiftClientManager::StartMatchmaking(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest) { AZStd::string response; @@ -427,7 +349,7 @@ namespace AWSGameLift { const AWSGameLiftStartMatchmakingRequest& gameliftStartMatchmakingRequest = static_cast(startMatchmakingRequest); - response = StartMatchmakingHelper(gameliftStartMatchmakingRequest); + response = StartMatchmakingActivity::StartMatchmaking(gameliftStartMatchmakingRequest); } return response; @@ -448,9 +370,9 @@ namespace AWSGameLift AZ::JobContext* jobContext = nullptr; AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext); AZ::Job* startMatchmakingJob = AZ::CreateJobFunction( - [this, gameliftStartMatchmakingRequest]() + [gameliftStartMatchmakingRequest]() { - AZStd::string response = StartMatchmakingHelper(gameliftStartMatchmakingRequest); + AZStd::string response = StartMatchmakingActivity::StartMatchmaking(gameliftStartMatchmakingRequest); AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast( &AzFramework::MatchmakingAsyncRequestNotifications::OnStartMatchmakingAsyncComplete, response); @@ -460,29 +382,14 @@ namespace AWSGameLift startMatchmakingJob->Start(); } - AZStd::string AWSGameLiftClientManager::StartMatchmakingHelper(const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest) - { - auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); - - AZStd::string response; - if (!gameliftClient) - { - AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage); - } - else - { - response = StartMatchmakingActivity::StartMatchmaking(*gameliftClient, startMatchmakingRequest); - } - return response; - } - void AWSGameLiftClientManager::StopMatchmaking(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest) { if (StopMatchmakingActivity::ValidateStopMatchmakingRequest(stopMatchmakingRequest)) { const AWSGameLiftStopMatchmakingRequest& gameliftStopMatchmakingRequest = static_cast(stopMatchmakingRequest); - StopMatchmakingHelper(gameliftStopMatchmakingRequest); + + StopMatchmakingActivity::StopMatchmaking(gameliftStopMatchmakingRequest); } } @@ -501,9 +408,9 @@ namespace AWSGameLift AZ::JobContext* jobContext = nullptr; AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext); AZ::Job* stopMatchmakingJob = AZ::CreateJobFunction( - [this, gameliftStopMatchmakingRequest]() + [gameliftStopMatchmakingRequest]() { - StopMatchmakingHelper(gameliftStopMatchmakingRequest); + StopMatchmakingActivity::StopMatchmaking(gameliftStopMatchmakingRequest); AzFramework::MatchmakingAsyncRequestNotificationBus::Broadcast( &AzFramework::MatchmakingAsyncRequestNotifications::OnStopMatchmakingAsyncComplete); @@ -512,18 +419,4 @@ namespace AWSGameLift stopMatchmakingJob->Start(); } - - void AWSGameLiftClientManager::StopMatchmakingHelper(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest) - { - auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); - - if (!gameliftClient) - { - AZ_Error(AWSGameLiftClientManagerName, false, AWSGameLiftClientMissingErrorMessage); - } - else - { - StopMatchmakingActivity::StopMatchmaking(*gameliftClient, stopMatchmakingRequest); - } - } } // namespace AWSGameLift diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.h b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.h index 8a0c91c36d..f37152bc60 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.h +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/AWSGameLiftClientManager.h @@ -175,14 +175,5 @@ namespace AWSGameLift bool JoinSession(const AzFramework::JoinSessionRequest& joinSessionRequest) override; AzFramework::SearchSessionsResponse SearchSessions(const AzFramework::SearchSessionsRequest& searchSessionsRequest) const override; void LeaveSession() override; - - private: - void AcceptMatchHelper(const AWSGameLiftAcceptMatchRequest& createSessionRequest); - AZStd::string CreateSessionHelper(const AWSGameLiftCreateSessionRequest& createSessionRequest); - AZStd::string CreateSessionOnQueueHelper(const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest); - bool JoinSessionHelper(const AWSGameLiftJoinSessionRequest& joinSessionRequest); - AzFramework::SearchSessionsResponse SearchSessionsHelper(const AWSGameLiftSearchSessionsRequest& searchSessionsRequest) const; - AZStd::string StartMatchmakingHelper(const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest); - void StopMatchmakingHelper(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest); }; } // namespace AWSGameLift diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftAcceptMatchActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftAcceptMatchActivity.cpp index 25ba328fd0..dbeced1728 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftAcceptMatchActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftAcceptMatchActivity.cpp @@ -7,9 +7,11 @@ */ #include +#include #include #include +#include #include #include @@ -42,13 +44,19 @@ namespace AWSGameLift return request; } - void AcceptMatch(const Aws::GameLift::GameLiftClient& gameliftClient, - const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest) + void AcceptMatch(const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest) { + auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); + if (!gameliftClient) + { + AZ_Error(AWSGameLiftAcceptMatchActivityName, false, AWSGameLiftClientMissingErrorMessage); + return; + } + AZ_TracePrintf(AWSGameLiftAcceptMatchActivityName, "Requesting AcceptMatch against Amazon GameLift service ..."); Aws::GameLift::Model::AcceptMatchRequest request = BuildAWSGameLiftAcceptMatchRequest(AcceptMatchRequest); - auto AcceptMatchOutcome = gameliftClient.AcceptMatch(request); + auto AcceptMatchOutcome = gameliftClient->AcceptMatch(request); if (AcceptMatchOutcome.IsSuccess()) { diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftAcceptMatchActivity.h b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftAcceptMatchActivity.h index d5f28f92e2..ac4012c347 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftAcceptMatchActivity.h +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftAcceptMatchActivity.h @@ -23,7 +23,7 @@ namespace AWSGameLift Aws::GameLift::Model::AcceptMatchRequest BuildAWSGameLiftAcceptMatchRequest(const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest); // Create AcceptMatchRequest and make a AcceptMatch call through GameLift client - void AcceptMatch(const Aws::GameLift::GameLiftClient& gameliftClient, const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest); + void AcceptMatch(const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest); // Validate AcceptMatchRequest and check required request parameters bool ValidateAcceptMatchRequest(const AzFramework::AcceptMatchRequest& AcceptMatchRequest); diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp index 0332ea7a76..ee93f022a1 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp @@ -6,9 +6,16 @@ * */ +#include +#include + #include #include #include +#include + +#include +#include namespace AWSGameLift { @@ -63,15 +70,21 @@ namespace AWSGameLift return request; } - AZStd::string CreateSession( - const Aws::GameLift::GameLiftClient& gameliftClient, - const AWSGameLiftCreateSessionRequest& createSessionRequest) + AZStd::string CreateSession(const AWSGameLiftCreateSessionRequest& createSessionRequest) { + AZStd::string result = ""; + + auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); + if (!gameliftClient) + { + AZ_Error(AWSGameLiftCreateSessionActivityName, false, AWSGameLiftClientMissingErrorMessage); + return result; + } + AZ_TracePrintf(AWSGameLiftCreateSessionActivityName, "Requesting CreateGameSession against Amazon GameLift service ..."); - AZStd::string result = ""; Aws::GameLift::Model::CreateGameSessionRequest request = BuildAWSGameLiftCreateGameSessionRequest(createSessionRequest); - auto createSessionOutcome = gameliftClient.CreateGameSession(request); + auto createSessionOutcome = gameliftClient->CreateGameSession(request); AZ_TracePrintf(AWSGameLiftCreateSessionActivityName, "CreateGameSession request against Amazon GameLift service is complete"); if (createSessionOutcome.IsSuccess()) diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.h b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.h index 714675c652..af236dbfa4 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.h +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.h @@ -10,9 +10,7 @@ #include -#include #include -#include namespace AWSGameLift { @@ -24,9 +22,7 @@ namespace AWSGameLift Aws::GameLift::Model::CreateGameSessionRequest BuildAWSGameLiftCreateGameSessionRequest(const AWSGameLiftCreateSessionRequest& createSessionRequest); // Create CreateGameSessionRequest and make a CreateGameSession call through GameLift client - AZStd::string CreateSession( - const Aws::GameLift::GameLiftClient& gameliftClient, - const AWSGameLiftCreateSessionRequest& createSessionRequest); + AZStd::string CreateSession(const AWSGameLiftCreateSessionRequest& createSessionRequest); // Validate CreateSessionRequest and check required request parameters bool ValidateCreateSessionRequest(const AzFramework::CreateSessionRequest& createSessionRequest); diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp index 52be365ea5..8e8d7e23c5 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp @@ -6,9 +6,16 @@ * */ +#include +#include + #include #include #include +#include + +#include +#include namespace AWSGameLift { @@ -47,17 +54,23 @@ namespace AWSGameLift return request; } - AZStd::string CreateSessionOnQueue( - const Aws::GameLift::GameLiftClient& gameliftClient, - const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest) + AZStd::string CreateSessionOnQueue(const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest) { + AZStd::string result = ""; + + auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); + if (!gameliftClient) + { + AZ_Error(AWSGameLiftCreateSessionOnQueueActivityName, false, AWSGameLiftClientMissingErrorMessage); + return result; + } + AZ_TracePrintf(AWSGameLiftCreateSessionOnQueueActivityName, "Requesting StartGameSessionPlacement against Amazon GameLift service ..."); - AZStd::string result = ""; Aws::GameLift::Model::StartGameSessionPlacementRequest request = BuildAWSGameLiftStartGameSessionPlacementRequest(createSessionOnQueueRequest); - auto createSessionOnQueueOutcome = gameliftClient.StartGameSessionPlacement(request); + auto createSessionOnQueueOutcome = gameliftClient->StartGameSessionPlacement(request); AZ_TracePrintf(AWSGameLiftCreateSessionOnQueueActivityName, "StartGameSessionPlacement request against Amazon GameLift service is complete."); diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.h b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.h index 714bcd1060..5f16bf0b31 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.h +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.h @@ -10,9 +10,7 @@ #include -#include #include -#include namespace AWSGameLift { @@ -25,9 +23,7 @@ namespace AWSGameLift const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest); // Create StartGameSessionPlacementRequest and make a CreateGameSession call through GameLift client - AZStd::string CreateSessionOnQueue( - const Aws::GameLift::GameLiftClient& gameliftClient, - const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest); + AZStd::string CreateSessionOnQueue(const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest); // Validate CreateSessionOnQueueRequest and check required request parameters bool ValidateCreateSessionOnQueueRequest(const AzFramework::CreateSessionRequest& createSessionRequest); diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp index a47e59255f..71ef9e9737 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp @@ -7,10 +7,11 @@ */ #include -#include +#include #include #include +#include namespace AWSGameLift { @@ -59,16 +60,24 @@ namespace AWSGameLift } Aws::GameLift::Model::CreatePlayerSessionOutcome CreatePlayerSession( - const Aws::GameLift::GameLiftClient& gameliftClient, const AWSGameLiftJoinSessionRequest& joinSessionRequest) { + Aws::GameLift::Model::CreatePlayerSessionOutcome createPlayerSessionOutcome; + + auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); + if (!gameliftClient) + { + AZ_Error(AWSGameLiftJoinSessionActivityName, false, AWSGameLiftClientMissingErrorMessage); + return createPlayerSessionOutcome; + } + AZ_TracePrintf(AWSGameLiftJoinSessionActivityName, "Requesting CreatePlayerSession for player %s against Amazon GameLift service ...", joinSessionRequest.m_playerId.c_str()); Aws::GameLift::Model::CreatePlayerSessionRequest request = BuildAWSGameLiftCreatePlayerSessionRequest(joinSessionRequest); - auto createPlayerSessionOutcome = gameliftClient.CreatePlayerSession(request); + createPlayerSessionOutcome = gameliftClient->CreatePlayerSession(request); AZ_TracePrintf(AWSGameLiftJoinSessionActivityName, "CreatePlayerSession request for player %s against Amazon GameLift service is complete", joinSessionRequest.m_playerId.c_str()); diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.h b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.h index fe34e5fe57..b011f4877b 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.h +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.h @@ -36,7 +36,6 @@ namespace AWSGameLift // Create CreatePlayerSessionRequest and make a CreatePlayerSession call through GameLift client Aws::GameLift::Model::CreatePlayerSessionOutcome CreatePlayerSession( - const Aws::GameLift::GameLiftClient& gameliftClient, const AWSGameLiftJoinSessionRequest& joinSessionRequest); // Request to setup networking connection for player diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftLeaveSessionActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftLeaveSessionActivity.cpp index a99fed4edc..fd3b3d6ebc 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftLeaveSessionActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftLeaveSessionActivity.cpp @@ -6,11 +6,12 @@ * */ -#include - #include +#include #include +#include + namespace AWSGameLift { namespace LeaveSessionActivity diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp index 5f0b6fd012..b7917e6d59 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp @@ -6,10 +6,16 @@ * */ +#include +#include #include #include #include +#include + +#include +#include namespace AWSGameLift { @@ -62,14 +68,21 @@ namespace AWSGameLift } AzFramework::SearchSessionsResponse SearchSessions( - const Aws::GameLift::GameLiftClient& gameliftClient, const AWSGameLiftSearchSessionsRequest& searchSessionsRequest) { + AzFramework::SearchSessionsResponse response; + + auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); + if (!gameliftClient) + { + AZ_Error(AWSGameLiftSearchSessionsActivityName, false, AWSGameLiftClientMissingErrorMessage); + return response; + } + AZ_TracePrintf(AWSGameLiftSearchSessionsActivityName, "Requesting SearchGameSessions against Amazon GameLift service ..."); - AzFramework::SearchSessionsResponse response; Aws::GameLift::Model::SearchGameSessionsRequest request = BuildAWSGameLiftSearchGameSessionsRequest(searchSessionsRequest); - Aws::GameLift::Model::SearchGameSessionsOutcome outcome = gameliftClient.SearchGameSessions(request); + Aws::GameLift::Model::SearchGameSessionsOutcome outcome = gameliftClient->SearchGameSessions(request); AZ_TracePrintf(AWSGameLiftSearchSessionsActivityName, "SearchGameSessions request against Amazon GameLift service is complete"); if (outcome.IsSuccess()) diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.h b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.h index 205e83dd96..d5bcda992c 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.h +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.h @@ -10,9 +10,7 @@ #include -#include #include -#include namespace AWSGameLift { @@ -28,7 +26,6 @@ namespace AWSGameLift // Create SearchGameSessionsRequest and make a SeachGameSessions call through GameLift client AzFramework::SearchSessionsResponse SearchSessions( - const Aws::GameLift::GameLiftClient& gameliftClient, const AWSGameLiftSearchSessionsRequest& searchSessionsRequest); // Convert from Aws::GameLift::Model::SearchGameSessionsResult to AzFramework::SearchSessionsResponse. diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStartMatchmakingActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStartMatchmakingActivity.cpp index 00a7773491..6f6c7fccc0 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStartMatchmakingActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStartMatchmakingActivity.cpp @@ -7,11 +7,13 @@ */ #include +#include #include #include #include #include +#include #include #include @@ -78,14 +80,21 @@ namespace AWSGameLift } AZStd::string StartMatchmaking( - const Aws::GameLift::GameLiftClient& gameliftClient, const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest) { + AZStd::string result = ""; + + auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); + if (!gameliftClient) + { + AZ_Error(AWSGameLiftStartMatchmakingActivityName, false, AWSGameLiftClientMissingErrorMessage); + return result; + } + AZ_TracePrintf(AWSGameLiftStartMatchmakingActivityName, "Requesting StartMatchmaking against Amazon GameLift service ..."); - AZStd::string result = ""; Aws::GameLift::Model::StartMatchmakingRequest request = BuildAWSGameLiftStartMatchmakingRequest(startMatchmakingRequest); - auto startMatchmakingOutcome = gameliftClient.StartMatchmaking(request); + auto startMatchmakingOutcome = gameliftClient->StartMatchmaking(request); if (startMatchmakingOutcome.IsSuccess()) { result = AZStd::string(startMatchmakingOutcome.GetResult().GetMatchmakingTicket().GetTicketId().c_str()); diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStartMatchmakingActivity.h b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStartMatchmakingActivity.h index db814c14b2..f736e318fb 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStartMatchmakingActivity.h +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStartMatchmakingActivity.h @@ -23,7 +23,7 @@ namespace AWSGameLift Aws::GameLift::Model::StartMatchmakingRequest BuildAWSGameLiftStartMatchmakingRequest(const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest); // Create StartMatchmakingRequest and make a StartMatchmaking call through GameLift client - AZStd::string StartMatchmaking(const Aws::GameLift::GameLiftClient& gameliftClient, const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest); + AZStd::string StartMatchmaking(const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest); // Validate StartMatchmakingRequest and check required request parameters bool ValidateStartMatchmakingRequest(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest); diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStopMatchmakingActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStopMatchmakingActivity.cpp index b427d0323a..022861570a 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStopMatchmakingActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStopMatchmakingActivity.cpp @@ -7,9 +7,11 @@ */ #include +#include #include #include +#include #include #include @@ -32,13 +34,19 @@ namespace AWSGameLift return request; } - void StopMatchmaking(const Aws::GameLift::GameLiftClient& gameliftClient, - const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest) + void StopMatchmaking(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest) { + auto gameliftClient = AZ::Interface::Get()->GetGameLiftClient(); + if (!gameliftClient) + { + AZ_Error(AWSGameLiftStopMatchmakingActivityName, false, AWSGameLiftClientMissingErrorMessage); + return; + } + AZ_TracePrintf(AWSGameLiftStopMatchmakingActivityName, "Requesting StopMatchmaking against Amazon GameLift service ..."); Aws::GameLift::Model::StopMatchmakingRequest request = BuildAWSGameLiftStopMatchmakingRequest(stopMatchmakingRequest); - auto stopMatchmakingOutcome = gameliftClient.StopMatchmaking(request); + auto stopMatchmakingOutcome = gameliftClient->StopMatchmaking(request); if (stopMatchmakingOutcome.IsSuccess()) { diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStopMatchmakingActivity.h b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStopMatchmakingActivity.h index 0820f2c05e..b5f19d35df 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStopMatchmakingActivity.h +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftStopMatchmakingActivity.h @@ -23,7 +23,7 @@ namespace AWSGameLift Aws::GameLift::Model::StopMatchmakingRequest BuildAWSGameLiftStopMatchmakingRequest(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest); // Create StopMatchmakingRequest and make a StopMatchmaking call through GameLift client - void StopMatchmaking(const Aws::GameLift::GameLiftClient& gameliftClient, const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest); + void StopMatchmaking(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest); // Validate StopMatchmakingRequest and check required request parameters bool ValidateStopMatchmakingRequest(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest); diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp index 70dcdba1af..fcf867138b 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp @@ -9,6 +9,8 @@ #include #include +#include + using namespace AWSGameLift; using AWSGameLiftCreateSessionActivityTest = AWSGameLiftClientFixture; diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp index 8a785d8007..4845586e47 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp @@ -9,6 +9,8 @@ #include #include +#include + using namespace AWSGameLift; using AWSGameLiftCreateSessionOnQueueActivityTest = AWSGameLiftClientFixture; diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftJoinSessionActivityTest.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftJoinSessionActivityTest.cpp index 6a1156646a..33b03649c7 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftJoinSessionActivityTest.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftJoinSessionActivityTest.cpp @@ -6,6 +6,8 @@ * */ +#include + #include #include diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftSearchSessionsActivityTest.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftSearchSessionsActivityTest.cpp index 3337c2f6d2..0d3c8c137b 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftSearchSessionsActivityTest.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftSearchSessionsActivityTest.cpp @@ -12,6 +12,9 @@ #include #include +#include +#include + using namespace AWSGameLift; using AWSGameLiftSearchSessionsActivityTest = AWSGameLiftClientFixture;