Skip to content

Commit fa29772

Browse files
authored
Merge pull request #8 from tfe/master
2 parents 435cdae + 5be081f commit fa29772

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Sources/SnapshotTestingHEIC/UIView.swift

+3
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,22 @@ public extension Snapshotting where Value == UIView, Format == UIImage {
1515
/// `UIAppearance` and `UIVisualEffect`s. This option requires a host application for your tests and
1616
/// will _not_ work for framework test targets.
1717
/// - precision: The percentage of pixels that must match.
18+
/// - 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)
1819
/// - size: A view size override.
1920
/// - traits: A trait collection override.
2021
/// - compressionQuality: The desired compression quality to use when writing to an image destination.
2122
static func imageHEIC(
2223
drawHierarchyInKeyWindow: Bool = false,
2324
precision: Float = 1,
25+
perceptualPrecision: Float = 1,
2426
size: CGSize? = nil,
2527
traits: UITraitCollection = .init(),
2628
compressionQuality: CompressionQuality = .lossless
2729
)
2830
-> Snapshotting {
2931
return SimplySnapshotting.imageHEIC(
3032
precision: precision,
33+
perceptualPrecision: perceptualPrecision,
3134
scale: traits.displayScale,
3235
compressionQuality: compressionQuality
3336
).asyncPullback { view in

Sources/SnapshotTestingHEIC/UIViewController.swift

+6
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,22 @@ public extension Snapshotting where Value == UIViewController, Format == UIImage
1313
/// - Parameters:
1414
/// - config: A set of device configuration settings.
1515
/// - precision: The percentage of pixels that must match.
16+
/// - 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)
1617
/// - size: A view size override.
1718
/// - traits: A trait collection override.
1819
/// - compressionQuality: The desired compression quality to use when writing to an image destination.
1920
static func imageHEIC(
2021
on config: ViewImageConfig,
2122
precision: Float = 1,
23+
perceptualPrecision: Float = 1,
2224
size: CGSize? = nil,
2325
traits: UITraitCollection = .init(),
2426
compressionQuality: CompressionQuality = .lossless
2527
)
2628
-> Snapshotting {
2729
return SimplySnapshotting.imageHEIC(
2830
precision: precision,
31+
perceptualPrecision: perceptualPrecision,
2932
scale: traits.displayScale,
3033
compressionQuality: compressionQuality
3134
).asyncPullback { viewController in
@@ -46,19 +49,22 @@ public extension Snapshotting where Value == UIViewController, Format == UIImage
4649
/// and `UIVisualEffect`s. This option requires a host application for your tests
4750
/// and will _not_ work for framework test targets.
4851
/// - precision: The percentage of pixels that must match.
52+
/// - 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)
4953
/// - size: A view size override.
5054
/// - traits: A trait collection override.
5155
/// - compressionQuality: The desired compression quality to use when writing to an image destination.
5256
static func imageHEIC(
5357
drawHierarchyInKeyWindow: Bool = false,
5458
precision: Float = 1,
59+
perceptualPrecision: Float = 1,
5560
size: CGSize? = nil,
5661
traits: UITraitCollection = .init(),
5762
compressionQuality: CompressionQuality = .lossless
5863
)
5964
-> Snapshotting {
6065
return SimplySnapshotting.imageHEIC(
6166
precision: precision,
67+
perceptualPrecision: perceptualPrecision,
6268
scale: traits.displayScale,
6369
compressionQuality: compressionQuality
6470
).asyncPullback { viewController in

0 commit comments

Comments
 (0)