FastNoiseTest.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #pragma once
  9. #include <AzFramework/Components/TransformComponent.h>
  10. #include <AzTest/GemTestEnvironment.h>
  11. #include <FastNoiseGradientComponent.h>
  12. #include <FastNoiseSystemComponent.h>
  13. namespace UnitTest
  14. {
  15. // The FastNoise unit tests need to use the GemTestEnvironment to load the GradientSignal and LmbrCentral Gems so that
  16. // GradientTransform components can be used in the unit tests and benchmarks.
  17. class FastNoiseTestEnvironment
  18. : public AZ::Test::GemTestEnvironment
  19. {
  20. public:
  21. void AddGemsAndComponents() override
  22. {
  23. AddDynamicModulePaths({ "GradientSignal", "LmbrCentral" });
  24. AddComponentDescriptors({
  25. AzFramework::TransformComponent::CreateDescriptor(),
  26. FastNoiseGem::FastNoiseSystemComponent::CreateDescriptor(),
  27. FastNoiseGem::FastNoiseGradientComponent::CreateDescriptor()
  28. });
  29. AddRequiredComponents({ FastNoiseGem::FastNoiseSystemComponent::TYPEINFO_Uuid() });
  30. }
  31. };
  32. #ifdef HAVE_BENCHMARK
  33. //! The Benchmark environment is used for one time setup and tear down of shared resources
  34. class FastNoiseBenchmarkEnvironment
  35. : public AZ::Test::BenchmarkEnvironmentBase
  36. , public FastNoiseTestEnvironment
  37. {
  38. protected:
  39. void SetUpBenchmark() override
  40. {
  41. SetupEnvironment();
  42. }
  43. void TearDownBenchmark() override
  44. {
  45. TeardownEnvironment();
  46. }
  47. };
  48. #endif
  49. } // namespace UnitTest