Skip to content

Commit

Permalink
Merge pull request #8 from tfe/master
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey1312 authored Mar 20, 2023
2 parents 435cdae + 5be081f commit fa29772
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/SnapshotTestingHEIC/UIView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@ public extension Snapshotting where Value == UIView, Format == UIImage {
/// `UIAppearance` and `UIVisualEffect`s. This option requires a host application for your tests and
/// will _not_ work for framework test targets.
/// - precision: The percentage of pixels that must match.
/// - perceptualPrecision: The percentage a pixel must match the source pixel to be considered a match. [98-99% mimics the precision of the human eye.](http://zschuessler.github.io/DeltaE/learn/#toc-defining-delta-e)
/// - size: A view size override.
/// - traits: A trait collection override.
/// - compressionQuality: The desired compression quality to use when writing to an image destination.
static func imageHEIC(
drawHierarchyInKeyWindow: Bool = false,
precision: Float = 1,
perceptualPrecision: Float = 1,
size: CGSize? = nil,
traits: UITraitCollection = .init(),
compressionQuality: CompressionQuality = .lossless
)
-> Snapshotting {
return SimplySnapshotting.imageHEIC(
precision: precision,
perceptualPrecision: perceptualPrecision,
scale: traits.displayScale,
compressionQuality: compressionQuality
).asyncPullback { view in
Expand Down
6 changes: 6 additions & 0 deletions Sources/SnapshotTestingHEIC/UIViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@ public extension Snapshotting where Value == UIViewController, Format == UIImage
/// - Parameters:
/// - config: A set of device configuration settings.
/// - precision: The percentage of pixels that must match.
/// - perceptualPrecision: The percentage a pixel must match the source pixel to be considered a match. [98-99% mimics the precision of the human eye.](http://zschuessler.github.io/DeltaE/learn/#toc-defining-delta-e)
/// - size: A view size override.
/// - traits: A trait collection override.
/// - compressionQuality: The desired compression quality to use when writing to an image destination.
static func imageHEIC(
on config: ViewImageConfig,
precision: Float = 1,
perceptualPrecision: Float = 1,
size: CGSize? = nil,
traits: UITraitCollection = .init(),
compressionQuality: CompressionQuality = .lossless
)
-> Snapshotting {
return SimplySnapshotting.imageHEIC(
precision: precision,
perceptualPrecision: perceptualPrecision,
scale: traits.displayScale,
compressionQuality: compressionQuality
).asyncPullback { viewController in
Expand All @@ -46,19 +49,22 @@ public extension Snapshotting where Value == UIViewController, Format == UIImage
/// and `UIVisualEffect`s. This option requires a host application for your tests
/// and will _not_ work for framework test targets.
/// - precision: The percentage of pixels that must match.
/// - perceptualPrecision: The percentage a pixel must match the source pixel to be considered a match. [98-99% mimics the precision of the human eye.](http://zschuessler.github.io/DeltaE/learn/#toc-defining-delta-e)
/// - size: A view size override.
/// - traits: A trait collection override.
/// - compressionQuality: The desired compression quality to use when writing to an image destination.
static func imageHEIC(
drawHierarchyInKeyWindow: Bool = false,
precision: Float = 1,
perceptualPrecision: Float = 1,
size: CGSize? = nil,
traits: UITraitCollection = .init(),
compressionQuality: CompressionQuality = .lossless
)
-> Snapshotting {
return SimplySnapshotting.imageHEIC(
precision: precision,
perceptualPrecision: perceptualPrecision,
scale: traits.displayScale,
compressionQuality: compressionQuality
).asyncPullback { viewController in
Expand Down

0 comments on commit fa29772

Please sign in to comment.