LandscapeCanvasTest.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 <AzTest/AzTest.h>
  9. #include <AzCore/Component/ComponentApplication.h>
  10. #include <AzCore/Component/Entity.h>
  11. #include <Source/LandscapeCanvasSystemComponent.h>
  12. class LandscapeCanvasTest
  13. : public ::testing::Test
  14. {
  15. protected:
  16. void SetUp() override
  17. {
  18. // Setup a system allocator
  19. AZ::ComponentApplication::Descriptor appDesc;
  20. m_application.Create(appDesc);
  21. m_application.RegisterComponentDescriptor(LandscapeCanvas::LandscapeCanvasSystemComponent::CreateDescriptor());
  22. }
  23. void TearDown() override
  24. {
  25. m_application.Destroy();
  26. }
  27. AZ::ComponentApplication m_application;
  28. };
  29. TEST_F(LandscapeCanvasTest, LandscapeCanvasSystemComponentCreatesAndDestroysSuccessfully)
  30. {
  31. LandscapeCanvas::LandscapeCanvasSystemComponent test;
  32. }
  33. TEST_F(LandscapeCanvasTest, LandscapeCanvasSystemComponentActivatesAndDeactivatesSuccessfully)
  34. {
  35. auto entity = AZStd::make_unique<AZ::Entity>();
  36. entity->CreateComponent<LandscapeCanvas::LandscapeCanvasSystemComponent>();
  37. entity->Init();
  38. EXPECT_EQ(AZ::Entity::State::Init, entity->GetState());
  39. entity->Activate();
  40. EXPECT_EQ(AZ::Entity::State::Active, entity->GetState());
  41. entity->Deactivate();
  42. EXPECT_EQ(AZ::Entity::State::Init, entity->GetState());
  43. }
  44. AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);