Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mackoj committed Sep 11, 2024
1 parent 1cb2b12 commit 12fe639
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import AppKit.NSImage
public typealias SnapImage = NSImage
#endif

// I would like to have something like this as something that represent the fileformat/identifier
// but due to the limitation of @objc that can only represent have Int for RawType for enum i'ml blocked.
// I need this to behave like a string
public enum ImageSerializationFormat: RawRepresentable, Sendable {
case png
case plugins(String)
Expand Down
4 changes: 2 additions & 2 deletions Sources/SnapshotTesting/Snapshotting/NSImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/// [the precision](http://zschuessler.github.io/DeltaE/learn/#toc-defining-delta-e) of the
/// human eye.
/// - Returns: A new diffing strategy.
public static func image(precision: Float = 1, perceptualPrecision: Float = 1, imageFormat: ImageSerializationFormat) -> Diffing {
public static func image(precision: Float = 1, perceptualPrecision: Float = 1, imageFormat: ImageSerializationFormat = imageFormat) -> Diffing {
let imageSerializer = ImageSerializer()
return .init(
toData: { imageSerializer.encodeImage($0, imageFormat: imageFormat)! },
Expand Down Expand Up @@ -55,7 +55,7 @@
/// match. 98-99% mimics
/// [the precision](http://zschuessler.github.io/DeltaE/learn/#toc-defining-delta-e) of the
/// human eye.
public static func image(precision: Float = 1, perceptualPrecision: Float = 1, imageFormat: ImageSerializationFormat) -> Snapshotting {
public static func image(precision: Float = 1, perceptualPrecision: Float = 1, imageFormat: ImageSerializationFormat = imageFormat) -> Snapshotting {
return .init(
pathExtension: imageFormat.rawValue,
diffing: .image(precision: precision, perceptualPrecision: perceptualPrecision, imageFormat: imageFormat)
Expand Down
4 changes: 2 additions & 2 deletions Sources/SnapshotTesting/Snapshotting/UIImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/// `UITraitCollection`s default value of `0.0`, the screens scale is used.
/// - Returns: A new diffing strategy.
public static func image(
precision: Float = 1, perceptualPrecision: Float = 1, scale: CGFloat? = nil, imageFormat: ImageSerializationFormat
precision: Float = 1, perceptualPrecision: Float = 1, scale: CGFloat? = nil, imageFormat: ImageSerializationFormat = imageFormat
) -> Diffing {
let imageScale: CGFloat
if let scale = scale, scale != 0.0 {
Expand Down Expand Up @@ -79,7 +79,7 @@
/// human eye.
/// - scale: The scale of the reference image stored on disk.
public static func image(
precision: Float = 1, perceptualPrecision: Float = 1, scale: CGFloat? = nil, imageFormat: ImageSerializationFormat
precision: Float = 1, perceptualPrecision: Float = 1, scale: CGFloat? = nil, imageFormat: ImageSerializationFormat = imageFormat
) -> Snapshotting {
return .init(
pathExtension: imageFormat.rawValue,
Expand Down

0 comments on commit 12fe639

Please sign in to comment.