ImageComparisonConfig.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 <Automation/ImageComparisonConfig.h>
  9. #include <AzCore/Serialization/SerializeContext.h>
  10. namespace AtomSampleViewer
  11. {
  12. void ImageComparisonConfig::Reflect(AZ::ReflectContext* context)
  13. {
  14. ImageComparisonToleranceLevel::Reflect(context);
  15. if (auto* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  16. {
  17. serializeContext->Class<ImageComparisonConfig>()
  18. ->Version(0)
  19. ->Field("toleranceLevels", &ImageComparisonConfig::m_toleranceLevels)
  20. ;
  21. }
  22. }
  23. void ImageComparisonToleranceLevel::Reflect(AZ::ReflectContext* context)
  24. {
  25. if (auto* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  26. {
  27. serializeContext->Class<ImageComparisonToleranceLevel>()
  28. ->Version(0)
  29. ->Field("name", &ImageComparisonToleranceLevel::m_name)
  30. ->Field("threshold", &ImageComparisonToleranceLevel::m_threshold)
  31. ->Field("filterImperceptibleDiffs", &ImageComparisonToleranceLevel::m_filterImperceptibleDiffs)
  32. ;
  33. }
  34. }
  35. AZStd::string ImageComparisonToleranceLevel::ToString() const
  36. {
  37. return AZStd::string::format("'%s' (threshold %f%s)", m_name.c_str(), m_threshold, m_filterImperceptibleDiffs ? ", filtered" : "");
  38. }
  39. } // namespace AtomSampleViewer