Skip to content

Commit abf8272

Browse files
committed
Renamed parameter 'pixelDiffThreshold' to 'subpixelThreshold'
1 parent 90db72c commit abf8272

File tree

12 files changed

+91
-67
lines changed

12 files changed

+91
-67
lines changed

SnapshotTesting.xcodeproj/project.pbxproj

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@
195195
F3883B573DF4CAFADE5968A9 /* testUpdateSeveralSnapshotsWithLessLines.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BC721A155DB7D81BE69683 /* testUpdateSeveralSnapshotsWithLessLines.1.swift */; };
196196
F473E43FAB7DD0C5F4D02437 /* testUpdateSeveralSnapshotsWithMoreLines.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECEC001D7DB94ECB4F5A2CF9 /* testUpdateSeveralSnapshotsWithMoreLines.1.swift */; };
197197
F4CB3EC3E5D30B217B4D9699 /* Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10213E0E8B550596F75463C3 /* Wait.swift */; };
198+
F5B874F327B3FA5F005D3517 /* UInt8+diff.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5B874F227B3FA5F005D3517 /* UInt8+diff.swift */; };
199+
F5B874F427B3FA5F005D3517 /* UInt8+diff.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5B874F227B3FA5F005D3517 /* UInt8+diff.swift */; };
200+
F5B874F527B3FA5F005D3517 /* UInt8+diff.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5B874F227B3FA5F005D3517 /* UInt8+diff.swift */; };
198201
F66FB66FCA7B884DA64ADDBE /* Diff.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EEE36D7D9E53E70DABA3996 /* Diff.swift */; };
199202
FBDFF661DB08CFB75DFB12C3 /* SnapshotTesting.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8F9883B60A8B403A39BCF888 /* SnapshotTesting.framework */; };
200203
FE365D5C0F83CE8459CF77DC /* testUpdateSnapshotWithMoreLines.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0BC8BF7E37686D31F59B9F6 /* testUpdateSnapshotWithMoreLines.1.swift */; };
@@ -333,6 +336,7 @@
333336
EE91B5904B3F67A3A01610C8 /* testCreateSnapshotWithShorterExtendedDelimiter1.1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = testCreateSnapshotWithShorterExtendedDelimiter1.1.swift; sourceTree = "<group>"; };
334337
F479E2BD835B9641B85EB51E /* Internal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Internal.swift; sourceTree = "<group>"; };
335338
F4D7D0D81B7E35C6284A3E65 /* testUpdateSnapshotWithExtendedDelimiter1.1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = testUpdateSnapshotWithExtendedDelimiter1.1.swift; sourceTree = "<group>"; };
339+
F5B874F227B3FA5F005D3517 /* UInt8+diff.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UInt8+diff.swift"; sourceTree = "<group>"; };
336340
F6D3BC50BC4692DC6D9FAE0F /* InlineSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InlineSnapshotTests.swift; sourceTree = "<group>"; };
337341
F8F831EAAFB97204ECD0B879 /* Any.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Any.swift; sourceTree = "<group>"; };
338342
FD800FD3282956340AD7706A /* AssertInlineSnapshot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssertInlineSnapshot.swift; sourceTree = "<group>"; };
@@ -451,6 +455,7 @@
451455
5768A55D77F19D897206FF9F /* Extensions */ = {
452456
isa = PBXGroup;
453457
children = (
458+
F5B874F227B3FA5F005D3517 /* UInt8+diff.swift */,
454459
10213E0E8B550596F75463C3 /* Wait.swift */,
455460
);
456461
path = Extensions;
@@ -646,8 +651,6 @@
646651
isa = PBXProject;
647652
attributes = {
648653
LastUpgradeCheck = 1020;
649-
TargetAttributes = {
650-
};
651654
};
652655
buildConfigurationList = D9A4BF45876C849A308801A2 /* Build configuration list for PBXProject "SnapshotTesting" */;
653656
compatibilityVersion = "Xcode 10.0";
@@ -703,6 +706,7 @@
703706
buildActionMask = 2147483647;
704707
files = (
705708
87D3745DBD172E3E6427190F /* Any.swift in Sources */,
709+
F5B874F427B3FA5F005D3517 /* UInt8+diff.swift in Sources */,
706710
6CAB0714112F5AAE5D0FBD23 /* AssertInlineSnapshot.swift in Sources */,
707711
52B7C3800F08E80D7BA8600D /* AssertSnapshot.swift in Sources */,
708712
1420B1BBC10CFF4D03C8AA67 /* Async.swift in Sources */,
@@ -743,6 +747,7 @@
743747
buildActionMask = 2147483647;
744748
files = (
745749
E2E1BA4E82EBF5D7E7533485 /* Any.swift in Sources */,
750+
F5B874F327B3FA5F005D3517 /* UInt8+diff.swift in Sources */,
746751
90555C6EB17BD465E901043A /* AssertInlineSnapshot.swift in Sources */,
747752
AE77649A377D5328DC91D19B /* AssertSnapshot.swift in Sources */,
748753
29602B6DD2A43E1C13DF1D42 /* Async.swift in Sources */,
@@ -855,6 +860,7 @@
855860
buildActionMask = 2147483647;
856861
files = (
857862
C48A4BD0534BF1817AF91098 /* Any.swift in Sources */,
863+
F5B874F527B3FA5F005D3517 /* UInt8+diff.swift in Sources */,
858864
56551E9E2E7A3DCF41C966F1 /* AssertInlineSnapshot.swift in Sources */,
859865
6C48EAD7C6D1441EE12F907B /* AssertSnapshot.swift in Sources */,
860866
45FAA85BB7198113155FD27F /* Async.swift in Sources */,
@@ -1017,7 +1023,10 @@
10171023
DYLIB_INSTALL_NAME_BASE = "@rpath";
10181024
ENABLE_BITCODE = NO;
10191025
ENABLE_TESTING_SEARCH_PATHS = YES;
1020-
FRAMEWORK_SEARCH_PATHS = "$(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks";
1026+
FRAMEWORK_SEARCH_PATHS = (
1027+
"$(inherited)",
1028+
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
1029+
);
10211030
INFOPLIST_FILE = Sources/Info.plist;
10221031
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
10231032
LD_RUNPATH_SEARCH_PATHS = (
@@ -1065,7 +1074,10 @@
10651074
DYLIB_INSTALL_NAME_BASE = "@rpath";
10661075
ENABLE_BITCODE = NO;
10671076
ENABLE_TESTING_SEARCH_PATHS = YES;
1068-
FRAMEWORK_SEARCH_PATHS = "$(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks";
1077+
FRAMEWORK_SEARCH_PATHS = (
1078+
"$(inherited)",
1079+
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
1080+
);
10691081
INFOPLIST_FILE = Sources/Info.plist;
10701082
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
10711083
LD_RUNPATH_SEARCH_PATHS = (
@@ -1146,7 +1158,10 @@
11461158
DYLIB_INSTALL_NAME_BASE = "@rpath";
11471159
ENABLE_BITCODE = NO;
11481160
ENABLE_TESTING_SEARCH_PATHS = YES;
1149-
FRAMEWORK_SEARCH_PATHS = "$(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks";
1161+
FRAMEWORK_SEARCH_PATHS = (
1162+
"$(inherited)",
1163+
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
1164+
);
11501165
INFOPLIST_FILE = Sources/Info.plist;
11511166
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
11521167
LD_RUNPATH_SEARCH_PATHS = (
@@ -1175,7 +1190,10 @@
11751190
DYLIB_INSTALL_NAME_BASE = "@rpath";
11761191
ENABLE_BITCODE = NO;
11771192
ENABLE_TESTING_SEARCH_PATHS = YES;
1178-
FRAMEWORK_SEARCH_PATHS = "$(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks";
1193+
FRAMEWORK_SEARCH_PATHS = (
1194+
"$(inherited)",
1195+
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
1196+
);
11791197
INFOPLIST_FILE = Sources/Info.plist;
11801198
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
11811199
LD_RUNPATH_SEARCH_PATHS = (
@@ -1204,7 +1222,10 @@
12041222
DYLIB_INSTALL_NAME_BASE = "@rpath";
12051223
ENABLE_BITCODE = NO;
12061224
ENABLE_TESTING_SEARCH_PATHS = YES;
1207-
FRAMEWORK_SEARCH_PATHS = "$(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks";
1225+
FRAMEWORK_SEARCH_PATHS = (
1226+
"$(inherited)",
1227+
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
1228+
);
12081229
INFOPLIST_FILE = Sources/Info.plist;
12091230
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
12101231
LD_RUNPATH_SEARCH_PATHS = (
@@ -1313,7 +1334,10 @@
13131334
DYLIB_INSTALL_NAME_BASE = "@rpath";
13141335
ENABLE_BITCODE = NO;
13151336
ENABLE_TESTING_SEARCH_PATHS = YES;
1316-
FRAMEWORK_SEARCH_PATHS = "$(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks";
1337+
FRAMEWORK_SEARCH_PATHS = (
1338+
"$(inherited)",
1339+
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
1340+
);
13171341
INFOPLIST_FILE = Sources/Info.plist;
13181342
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
13191343
LD_RUNPATH_SEARCH_PATHS = (

Sources/SnapshotTesting/Snapshotting/CALayer.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import Cocoa
44
extension Snapshotting where Value == CALayer, Format == NSImage {
55
/// A snapshot strategy for comparing layers based on pixel equality.
66
public static var image: Snapshotting {
7-
return .image(precision: 1, pixelDiffThreshold: 0)
7+
return .image(precision: 1, subpixelThreshold: 0)
88
}
99

1010
/// A snapshot strategy for comparing layers based on pixel equality.
1111
///
1212
/// - Parameter precision: The percentage of pixels that must match.
13-
/// - Parameter pixelDiffThreshold: The byte-value threshold at which two pixels are considered different.
14-
public static func image(precision: Float, pixelDiffThreshold: UInt8) -> Snapshotting {
15-
return SimplySnapshotting.image(precision: precision, pixelDiffThreshold: pixelDiffThreshold).pullback { layer in
13+
/// - Parameter subpixelThreshold: The byte-value threshold at which two subpixels are considered different.
14+
public static func image(precision: Float, subpixelThreshold: UInt8) -> Snapshotting {
15+
return SimplySnapshotting.image(precision: precision, subpixelThreshold: subpixelThreshold).pullback { layer in
1616
let image = NSImage(size: layer.bounds.size)
1717
image.lockFocus()
1818
let context = NSGraphicsContext.current!.cgContext
@@ -36,10 +36,10 @@ extension Snapshotting where Value == CALayer, Format == UIImage {
3636
/// A snapshot strategy for comparing layers based on pixel equality.
3737
///
3838
/// - Parameter precision: The percentage of pixels that must match.
39-
/// - Parameter pixelDiffThreshold: The byte-value threshold at which two pixels are considered different.
40-
public static func image(precision: Float = 1, pixelDiffThreshold: UInt8 = 0, traits: UITraitCollection = .init())
39+
/// - Parameter subpixelThreshold: The byte-value threshold at which two subpixels are considered different.
40+
public static func image(precision: Float = 1, subpixelThreshold: UInt8 = 0, traits: UITraitCollection = .init())
4141
-> Snapshotting {
42-
return SimplySnapshotting.image(precision: precision, pixelDiffThreshold: pixelDiffThreshold, scale: traits.displayScale).pullback { layer in
42+
return SimplySnapshotting.image(precision: precision, subpixelThreshold: subpixelThreshold, scale: traits.displayScale).pullback { layer in
4343
renderer(bounds: layer.bounds, for: traits).image { ctx in
4444
layer.setNeedsLayout()
4545
layer.layoutIfNeeded()

Sources/SnapshotTesting/Snapshotting/CGPath.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ extension Snapshotting where Value == CGPath, Format == NSImage {
1010
/// A snapshot strategy for comparing bezier paths based on pixel equality.
1111
///
1212
/// - Parameter precision: The percentage of pixels that must match.
13-
/// - Parameter pixelDiffThreshold: The byte-value threshold at which two pixels are considered different.
14-
public static func image(precision: Float = 1, pixelDiffThreshold: UInt8 = 0, drawingMode: CGPathDrawingMode = .eoFill) -> Snapshotting {
15-
return SimplySnapshotting.image(precision: precision, pixelDiffThreshold: pixelDiffThreshold).pullback { path in
13+
/// - Parameter subpixelThreshold: The byte-value threshold at which two subpixels are considered different.
14+
public static func image(precision: Float = 1, subpixelThreshold: UInt8 = 0, drawingMode: CGPathDrawingMode = .eoFill) -> Snapshotting {
15+
return SimplySnapshotting.image(precision: precision, subpixelThreshold: subpixelThreshold).pullback { path in
1616
let bounds = path.boundingBoxOfPath
1717
var transform = CGAffineTransform(translationX: -bounds.origin.x, y: -bounds.origin.y)
1818
let path = path.copy(using: &transform)!
@@ -40,10 +40,10 @@ extension Snapshotting where Value == CGPath, Format == UIImage {
4040
/// A snapshot strategy for comparing bezier paths based on pixel equality.
4141
///
4242
/// - Parameter precision: The percentage of pixels that must match.
43-
/// - Parameter pixelDiffThreshold: The byte-value threshold at which two pixels are considered different.
43+
/// - Parameter subpixelThreshold: The byte-value threshold at which two subpixels are considered different.
4444

45-
public static func image(precision: Float = 1, pixelDiffThreshold: UInt8 = 0, scale: CGFloat = 1, drawingMode: CGPathDrawingMode = .eoFill) -> Snapshotting {
46-
return SimplySnapshotting.image(precision: precision, pixelDiffThreshold: pixelDiffThreshold, scale: scale).pullback { path in
45+
public static func image(precision: Float = 1, subpixelThreshold: UInt8 = 0, scale: CGFloat = 1, drawingMode: CGPathDrawingMode = .eoFill) -> Snapshotting {
46+
return SimplySnapshotting.image(precision: precision, subpixelThreshold: subpixelThreshold, scale: scale).pullback { path in
4747
let bounds = path.boundingBoxOfPath
4848
let format: UIGraphicsImageRendererFormat
4949
if #available(iOS 11.0, tvOS 11.0, *) {

Sources/SnapshotTesting/Snapshotting/NSBezierPath.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ extension Snapshotting where Value == NSBezierPath, Format == NSImage {
1010
/// A snapshot strategy for comparing bezier paths based on pixel equality.
1111
///
1212
/// - Parameter precision: The percentage of pixels that must match.
13-
/// - Parameter pixelDiffThreshold: The byte-value threshold at which two pixels are considered different.
14-
public static func image(precision: Float = 1, pixelDiffThreshold: UInt8 = 0) -> Snapshotting {
15-
return SimplySnapshotting.image(precision: precision, pixelDiffThreshold: pixelDiffThreshold).pullback { path in
13+
/// - Parameter subpixelThreshold: The byte-value threshold at which two subpixels are considered different.
14+
public static func image(precision: Float = 1, subpixelThreshold: UInt8 = 0) -> Snapshotting {
15+
return SimplySnapshotting.image(precision: precision, subpixelThreshold: subpixelThreshold).pullback { path in
1616
// Move path info frame:
1717
let bounds = path.bounds
1818
let transform = AffineTransform(translationByX: -bounds.origin.x, byY: -bounds.origin.y)

Sources/SnapshotTesting/Snapshotting/NSImage.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ import XCTest
44

55
extension Diffing where Value == NSImage {
66
/// A pixel-diffing strategy for NSImage's which requires a 100% match.
7-
public static let image: Diffing = Diffing.image(precision: 1, pixelDiffThreshold: 0)
7+
public static let image: Diffing = Diffing.image(precision: 1, subpixelThreshold: 0)
88

99
/// A pixel-diffing strategy for NSImage that allows customizing how precise the matching must be.
1010
///
1111
/// - Parameter precision: A value between 0 and 1, where 1 means the images must match 100% of their pixels.
12-
/// - Parameter pixelDiffThreshold: The byte-value threshold at which two pixels are considered different.
12+
/// - Parameter subpixelThreshold: The byte-value threshold at which two subpixels are considered different.
1313
/// - Returns: A new diffing strategy.
14-
public static func image(precision: Float, pixelDiffThreshold: UInt8) -> Diffing {
14+
public static func image(precision: Float, subpixelThreshold: UInt8) -> Diffing {
1515
return .init(
1616
toData: { NSImagePNGRepresentation($0)! },
1717
fromData: { NSImage(data: $0)! }
1818
) { old, new in
19-
guard !compare(old, new, precision: precision, pixelDiffThreshold: pixelDiffThreshold) else { return nil }
19+
guard !compare(old, new, precision: precision, subpixelThreshold: subpixelThreshold) else { return nil }
2020
let difference = SnapshotTesting.diff(old, new)
2121
let message = new.size == old.size
2222
? "Newly-taken snapshot does not match reference."
@@ -32,17 +32,17 @@ extension Diffing where Value == NSImage {
3232
extension Snapshotting where Value == NSImage, Format == NSImage {
3333
/// A snapshot strategy for comparing images based on pixel equality.
3434
public static var image: Snapshotting {
35-
return .image(precision: 1, pixelDiffThreshold: 0)
35+
return .image(precision: 1, subpixelThreshold: 0)
3636
}
3737

3838
/// A snapshot strategy for comparing images based on pixel equality.
3939
///
4040
/// - Parameter precision: The percentage of pixels that must match.
41-
/// - Parameter pixelDiffThreshold: The byte-value threshold at which two pixels are considered different.
42-
public static func image(precision: Float, pixelDiffThreshold: UInt8) -> Snapshotting {
41+
/// - Parameter subpixelThreshold: The byte-value threshold at which two subpixels are considered different.
42+
public static func image(precision: Float, subpixelThreshold: UInt8) -> Snapshotting {
4343
return .init(
4444
pathExtension: "png",
45-
diffing: .image(precision: precision, pixelDiffThreshold: pixelDiffThreshold)
45+
diffing: .image(precision: precision, subpixelThreshold: subpixelThreshold)
4646
)
4747
}
4848
}
@@ -54,7 +54,7 @@ private func NSImagePNGRepresentation(_ image: NSImage) -> Data? {
5454
return rep.representation(using: .png, properties: [:])
5555
}
5656

57-
private func compare(_ old: NSImage, _ new: NSImage, precision: Float, pixelDiffThreshold: UInt8) -> Bool {
57+
private func compare(_ old: NSImage, _ new: NSImage, precision: Float, subpixelThreshold: UInt8) -> Bool {
5858
guard let oldCgImage = old.cgImage(forProposedRect: nil, context: nil, hints: nil) else { return false }
5959
guard let newCgImage = new.cgImage(forProposedRect: nil, context: nil, hints: nil) else { return false }
6060
guard oldCgImage.width != 0 else { return false }
@@ -85,7 +85,7 @@ private func compare(_ old: NSImage, _ new: NSImage, precision: Float, pixelDiff
8585

8686
var offset = 0
8787
while offset < pixelCount * 4 {
88-
if p1[offset] != p2[offset] {
88+
if p1[offset].diff(between: p2[offset]) > subpixelThreshold {
8989
differentPixelCount += 1
9090
if differentPixelCount > threshold {
9191
return false

Sources/SnapshotTesting/Snapshotting/NSView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ extension Snapshotting where Value == NSView, Format == NSImage {
1111
///
1212
/// - Parameters:
1313
/// - precision: The percentage of pixels that must match.
14-
/// - pixelDiffThreshold: The byte-value threshold at which two pixels are considered different.
14+
/// - subpixelThreshold: The byte-value threshold at which two subpixels are considered different.
1515
/// - size: A view size override.
16-
public static func image(precision: Float = 1, pixelDiffThreshold: UInt8 = 0, size: CGSize? = nil) -> Snapshotting {
17-
return SimplySnapshotting.image(precision: precision, pixelDiffThreshold: pixelDiffThreshold).asyncPullback { view in
16+
public static func image(precision: Float = 1, subpixelThreshold: UInt8 = 0, size: CGSize? = nil) -> Snapshotting {
17+
return SimplySnapshotting.image(precision: precision, subpixelThreshold: subpixelThreshold).asyncPullback { view in
1818
let initialSize = view.frame.size
1919
if let size = size { view.frame.size = size }
2020
guard view.frame.width > 0, view.frame.height > 0 else {

Sources/SnapshotTesting/Snapshotting/NSViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ extension Snapshotting where Value == NSViewController, Format == NSImage {
1111
///
1212
/// - Parameters:
1313
/// - precision: The percentage of pixels that must match.
14-
/// - pixelDiffThreshold: The byte-value threshold at which two pixels are considered different.
14+
/// - subpixelThreshold: The byte-value threshold at which two subpixels are considered different.
1515
/// - size: A view size override.
16-
public static func image(precision: Float = 1, pixelDiffThreshold: UInt8 = 0, size: CGSize? = nil) -> Snapshotting {
17-
return Snapshotting<NSView, NSImage>.image(precision: precision, pixelDiffThreshold: pixelDiffThreshold, size: size).pullback { $0.view }
16+
public static func image(precision: Float = 1, subpixelThreshold: UInt8 = 0, size: CGSize? = nil) -> Snapshotting {
17+
return Snapshotting<NSView, NSImage>.image(precision: precision, subpixelThreshold: subpixelThreshold, size: size).pullback { $0.view }
1818
}
1919
}
2020

Sources/SnapshotTesting/Snapshotting/SwiftUIView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ extension Snapshotting where Value: SwiftUI.View, Format == UIImage {
2828
/// - Parameters:
2929
/// - drawHierarchyInKeyWindow: Utilize the simulator's key window in order to render `UIAppearance` and `UIVisualEffect`s. This option requires a host application for your tests and will _not_ work for framework test targets.
3030
/// - precision: The percentage of pixels that must match.
31-
/// - pixelDiffThreshold: The byte-value threshold at which two pixels are considered different.
31+
/// - subpixelThreshold: The byte-value threshold at which two subpixels are considered different.
3232
/// - size: A view size override.
3333
/// - traits: A trait collection override.
3434
public static func image(
3535
drawHierarchyInKeyWindow: Bool = false,
3636
precision: Float = 1,
37-
pixelDiffThreshold: UInt8 = 0,
37+
subpixelThreshold: UInt8 = 0,
3838
layout: SwiftUISnapshotLayout = .sizeThatFits,
3939
traits: UITraitCollection = .init()
4040
)
@@ -53,7 +53,7 @@ extension Snapshotting where Value: SwiftUI.View, Format == UIImage {
5353
config = .init(safeArea: .zero, size: size, traits: traits)
5454
}
5555

56-
return SimplySnapshotting.image(precision: precision, pixelDiffThreshold: pixelDiffThreshold, scale: traits.displayScale).asyncPullback { view in
56+
return SimplySnapshotting.image(precision: precision, subpixelThreshold: subpixelThreshold, scale: traits.displayScale).asyncPullback { view in
5757
var config = config
5858

5959
let controller: UIViewController

0 commit comments

Comments
 (0)