Main.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzCore/Component/Component.h>
  9. #include <AzCore/Memory/SystemAllocator.h>
  10. #include <AzCore/UserSettings/UserSettingsComponent.h>
  11. #include <AzTest/AzTest.h>
  12. #include <AzTest/GemTestEnvironment.h>
  13. #include <AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.h>
  14. #include <AzToolsFramework/UnitTest/ToolsTestApplication.h>
  15. #include <CoreLights/EditorAreaLightComponent.h>
  16. class AtomLyIntegrationHook : public AZ::Test::GemTestEnvironment
  17. {
  18. // AZ::Test::GemTestEnvironment overrides ...
  19. void AddGemsAndComponents() override;
  20. AZ::ComponentApplication* CreateApplicationInstance() override;
  21. void PostSystemEntityActivate() override;
  22. public:
  23. AtomLyIntegrationHook() = default;
  24. ~AtomLyIntegrationHook() override = default;
  25. };
  26. void AtomLyIntegrationHook::AddGemsAndComponents()
  27. {
  28. AddDynamicModulePaths({ "LmbrCentral.Editor" });
  29. AddComponentDescriptors(AZStd::initializer_list<AZ::ComponentDescriptor*>{
  30. AZ::Render::AreaLightComponent::CreateDescriptor(),
  31. AZ::Render::EditorAreaLightComponent::CreateDescriptor()});
  32. }
  33. AZ::ComponentApplication* AtomLyIntegrationHook::CreateApplicationInstance()
  34. {
  35. // Using ToolsTestApplication to have AzFramework and AzToolsFramework components.
  36. return aznew UnitTest::ToolsTestApplication("EditorAtomLyIntegration");
  37. }
  38. void AtomLyIntegrationHook::PostSystemEntityActivate()
  39. {
  40. AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequestBus::Events::DisableSaveOnFinalize);
  41. }
  42. AZ_TOOLS_UNIT_TEST_HOOK(new AtomLyIntegrationHook)