diff --git a/Package.resolved b/Package.resolved index 0ac882f..0c7ecd1 100644 --- a/Package.resolved +++ b/Package.resolved @@ -3,10 +3,19 @@ { "identity" : "swift-snapshot-testing", "kind" : "remoteSourceControl", - "location" : "https://github.com/pimms/swift-snapshot-testing.git", + "location" : "https://github.com/pointfreeco/swift-snapshot-testing", "state" : { - "revision" : "b44b563e6ddc5a613a107fb57626047a7f1d4e1a", - "version" : "1.9.666" + "revision" : "625ccca8570773dd84a34ee51a81aa2bc5a4f97a", + "version" : "1.16.0" + } + }, + { + "identity" : "swift-syntax", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-syntax", + "state" : { + "revision" : "fa8f95c2d536d6620cc2f504ebe8a6167c9fc2dd", + "version" : "510.0.1" } } ], diff --git a/Package.swift b/Package.swift index 0863a9e..ef4f99d 100644 --- a/Package.swift +++ b/Package.swift @@ -12,7 +12,7 @@ let package = Package( .library(name: "DemoKitSnapshot", targets: ["DemoKitSnapshot"]), ], dependencies: [ - .package(url: "https://github.com/pimms/swift-snapshot-testing.git", exact: "1.9.666"), + .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", exact: "1.16.0") ], targets: [ .target( diff --git a/Sources/DemoKitSnapshot/XCTestCase+Extensions.swift b/Sources/DemoKitSnapshot/XCTestCase+Extensions.swift index 82b9c12..f795bb9 100644 --- a/Sources/DemoKitSnapshot/XCTestCase+Extensions.swift +++ b/Sources/DemoKitSnapshot/XCTestCase+Extensions.swift @@ -34,6 +34,9 @@ extension XCTestCase { public func snapshotTest( demoable: any Demoable, record: Bool = false, + // https://github.com/pointfreeco/swift-snapshot-testing/pull/628#issuecomment-1256363278 + precision: Float = 1, + perceptualPrecision: Float = 0.98, file: StaticString = #file, line: UInt = #line ) { @@ -52,6 +55,8 @@ extension XCTestCase { record: record, testName: demoable.identifier, tweakName: tweak.testName, + precision: precision, + perceptualPrecision: perceptualPrecision, file: file, line: line ) @@ -61,6 +66,8 @@ extension XCTestCase { viewController: viewController, record: record, testName: demoable.identifier, + precision: precision, + perceptualPrecision: perceptualPrecision, file: file, line: line ) @@ -145,11 +152,12 @@ extension XCTestCase { record: Bool, testName: String, tweakName: String? = nil, + precision: Float = 1, + perceptualPrecision: Float = 0.98, file: StaticString, line: UInt ) { UIView.setAnimationsEnabled(false) - let subpixelThreshold: UInt8 = 5 let userInterfaceStyle: [UIUserInterfaceStyle] = [.light, .dark] userInterfaceStyle.forEach { userInterfaceStyle in @@ -165,7 +173,8 @@ extension XCTestCase { matching: viewController, as: .image( on: device.imageConfig, - subpixelThreshold: subpixelThreshold, + precision: precision, + perceptualPrecision: perceptualPrecision, traits: traits ), named: name,