From f62ba7d1a4d42c84cab617bc7ef0db34a7ed365f Mon Sep 17 00:00:00 2001 From: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> Date: Thu, 9 Dec 2021 09:30:24 +0000 Subject: [PATCH] Add ComponentApplicationLifecycle::RegisterEvent calls to avoid test console spam (#6245) Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> --- Code/Framework/AzToolsFramework/Tests/Main.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Code/Framework/AzToolsFramework/Tests/Main.cpp b/Code/Framework/AzToolsFramework/Tests/Main.cpp index 6cb8ca01bd..a1b5638d6c 100644 --- a/Code/Framework/AzToolsFramework/Tests/Main.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Main.cpp @@ -6,18 +6,17 @@ * */ -#include #include +#include #include #include #include #include #include +#include #include -using namespace AZ; - // Handle asserts class ToolsFrameworkHook : public AZ::Test::ITestEnvironment @@ -25,12 +24,12 @@ class ToolsFrameworkHook public: void SetupEnvironment() override { - AllocatorInstance::Create(); + AZ::AllocatorInstance::Create(); } void TeardownEnvironment() override { - AllocatorInstance::Destroy(); + AZ::AllocatorInstance::Destroy(); } }; @@ -38,12 +37,17 @@ AZTEST_EXPORT int AZ_UNIT_TEST_HOOK_NAME(int argc, char** argv) { ::testing::InitGoogleMock(&argc, argv); QApplication app(argc, argv); - auto styleManager = AZStd::make_unique< AzQtComponents::StyleManager>(&app); + auto styleManager = AZStd::make_unique(&app); AZ::IO::FixedMaxPath engineRootPath; { AZ::ComponentApplication componentApplication(argc, argv); auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry->Get(engineRootPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder); + + AZ::ComponentApplicationLifecycle::RegisterEvent(*settingsRegistry, "SystemComponentsDeactivated"); + AZ::ComponentApplicationLifecycle::RegisterEvent(*settingsRegistry, "ConsoleUnavailable"); + AZ::ComponentApplicationLifecycle::RegisterEvent(*settingsRegistry, "SettingsRegistryUnavailable"); + AZ::ComponentApplicationLifecycle::RegisterEvent(*settingsRegistry, "SystemAllocatorPendingDestruction"); } styleManager->initialize(&app, engineRootPath); AZ::Test::printUnusedParametersWarning(argc, argv);