Repository: airbnb/lottie-ios
File: Tests/SnapshotConfiguration.swift (Swift)

Code before:
// Created by Cal Stephens on 12/15/21.
// Copyright © 2021 Airbnb Inc. All rights reserved.

#if canImport(UIKit)
import Lottie
import UIKit

// MARK: - SnapshotConfiguration

/// Snapshot configuration for an individual test case
struct SnapshotConfiguration {
  /// The precision that should be used when comparing the
  /// captured snapshot with the reference image in `Tests/__Snapshots`
  ///  - This can be lowered for snapshots that render somewhat nondeterministically,
  ///    but should be kept as high as possible (while still permitting the diff to succeed)
  var precision: Float = 0.985

  /// Dynamic value providers that should be applied to the animation
  var customValueProviders: [AnimationKeypath: AnyValueProvider] = [:]

  /// A custom `AnimationImageProvider` to use when rendering this animation
  var customImageProvider: AnimationImageProvider?

  /// A custom `AnimationKeypathTextProvider` to use when rendering this animation
  var customTextProvider: AnimationKeypathTextProvider?

  /// A custom `AnimationFontProvider` to use when rendering this animation
  var customFontProvider: AnimationFontProvider?

  /// Whether or not this sample should be tested with the automatic engine
  ///  - Defaults to `false` since this isn't necessary most of the time
  ///  - Enabling this for a set of animations gives us a regression suite for
  ///    the code supporting the automatic engine.
  var testWithAutomaticEngine = false

  /// Whether or not this sample should be excluded from testing with the Core Animation rendering engine
  ///  - Can be used for animations that are very expensive to render with the CA engine
  var excludeCoreAnimationRenderingEngine = false

  /// Custom progress values (from 0 to 1) that should be screenshot

Review comment (suggestion):
```suggestion
  ///    but should be kept as high as possible (while still permitting the diff to succeed)
  /// - Defaults to 0.985 to reduce the number of flaky snapshots due to small differences
  ///    in rendering based on OS version.
```

Code after:
// Created by Cal Stephens on 12/15/21.
// Copyright © 2021 Airbnb Inc. All rights reserved.

#if canImport(UIKit)
import Lottie
import UIKit

// MARK: - SnapshotConfiguration

/// Snapshot configuration for an individual test case
struct SnapshotConfiguration {
  /// The precision that should be used when comparing the
  /// captured snapshot with the reference image in `Tests/__Snapshots`
  ///  - This can be lowered for snapshots that render somewhat nondeterministically,
  ///    but should be kept as high as possible (while still permitting the diff to succeed)
  /// - Defaults to 0.985 to reduce the number of flaky snapshots due to small differences
  ///    in rendering based on OS version.
  var precision: Float = 0.985

  /// Dynamic value providers that should be applied to the animation
  var customValueProviders: [AnimationKeypath: AnyValueProvider] = [:]

  /// A custom `AnimationImageProvider` to use when rendering this animation
  var customImageProvider: AnimationImageProvider?

  /// A custom `AnimationKeypathTextProvider` to use when rendering this animation
  var customTextProvider: AnimationKeypathTextProvider?

  /// A custom `AnimationFontProvider` to use when rendering this animation
  var customFontProvider: AnimationFontProvider?

  /// Whether or not this sample should be tested with the automatic engine
  ///  - Defaults to `false` since this isn't necessary most of the time
  ///  - Enabling this for a set of animations gives us a regression suite for
  ///    the code supporting the automatic engine.
  var testWithAutomaticEngine = false

  /// Whether or not this sample should be excluded from testing with the Core Animation rendering engine
  ///  - Can be used for animations that are very expensive to render with the CA engine
  var excludeCoreAnimationRenderingEngine = false