ScriptEventTestUtilities.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 "ScriptEventTestUtilities.h"
  9. #include <AzCore/RTTI/ReflectContext.h>
  10. #include <AzCore/RTTI/BehaviorContext.h>
  11. #include <AzCore/RTTI/RTTI.h>
  12. #include <AzTest/AzTest.h>
  13. namespace ScriptEventsTests
  14. {
  15. namespace Utilities
  16. {
  17. void Reflect(AZ::ReflectContext* context)
  18. {
  19. if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
  20. {
  21. behaviorContext->Method("ScriptExpectTrue", &ScriptExpectTrue);
  22. behaviorContext->Method("ScriptTrace", &ScriptTrace);
  23. }
  24. }
  25. void ScriptExpectTrue(bool check, const char* msg)
  26. {
  27. (void)check; (void)msg;
  28. EXPECT_TRUE(check) << msg;
  29. }
  30. void ScriptTrace(const char* txt)
  31. {
  32. static bool showTraces = true;
  33. if (showTraces)
  34. {
  35. std::cerr << txt << std::endl;
  36. }
  37. }
  38. }
  39. }