ImageComparisonConfig.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. * its licensors.
  4. *
  5. * For complete copyright and license terms please see the LICENSE at the root of this
  6. * distribution (the "License"). All use of this software is governed by the License,
  7. * or, if provided, by the license below or the license accompanying this file. Do not
  8. * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. *
  11. */
  12. #include <Automation/ImageComparisonConfig.h>
  13. #include <AzCore/Serialization/SerializeContext.h>
  14. namespace AtomSampleViewer
  15. {
  16. void ImageComparisonConfig::Reflect(AZ::ReflectContext* context)
  17. {
  18. ImageComparisonToleranceLevel::Reflect(context);
  19. if (auto* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  20. {
  21. serializeContext->Class<ImageComparisonConfig>()
  22. ->Version(0)
  23. ->Field("toleranceLevels", &ImageComparisonConfig::m_toleranceLevels)
  24. ;
  25. }
  26. }
  27. void ImageComparisonToleranceLevel::Reflect(AZ::ReflectContext* context)
  28. {
  29. if (auto* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  30. {
  31. serializeContext->Class<ImageComparisonToleranceLevel>()
  32. ->Version(0)
  33. ->Field("name", &ImageComparisonToleranceLevel::m_name)
  34. ->Field("threshold", &ImageComparisonToleranceLevel::m_threshold)
  35. ->Field("filterImperceptibleDiffs", &ImageComparisonToleranceLevel::m_filterImperceptibleDiffs)
  36. ;
  37. }
  38. }
  39. AZStd::string ImageComparisonToleranceLevel::ToString() const
  40. {
  41. return AZStd::string::format("'%s' (threshold %f%s)", m_name.c_str(), m_threshold, m_filterImperceptibleDiffs ? ", filtered" : "");
  42. }
  43. } // namespace AtomSampleViewer