Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade-snapshot-tests-dependency-fix #5

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Sources/DemoKitSnapshot/XCTestCase+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 0.98,
perceptualPrecision: Float = 0.98,
file: StaticString = #file,
line: UInt = #line
) {
Expand All @@ -50,8 +53,10 @@ extension XCTestCase {
performSnapshots(
viewController: viewController,
record: record,
testName: demoable.identifier,
testName: demoable.identifier,
tweakName: tweak.testName,
precision: precision,
perceptualPrecision: perceptualPrecision,
file: file,
line: line
)
Expand All @@ -61,6 +66,8 @@ extension XCTestCase {
viewController: viewController,
record: record,
testName: demoable.identifier,
precision: precision,
perceptualPrecision: perceptualPrecision,
file: file,
line: line
)
Expand Down Expand Up @@ -145,11 +152,12 @@ extension XCTestCase {
record: Bool,
testName: String,
tweakName: String? = nil,
precision: Float = 0.98,
perceptualPrecision: Float = 0.98,
file: StaticString,
line: UInt
) {
UIView.setAnimationsEnabled(false)
let subpixelThreshold: UInt8 = 5
let userInterfaceStyle: [UIUserInterfaceStyle] = [.light, .dark]

userInterfaceStyle.forEach { userInterfaceStyle in
Expand All @@ -165,7 +173,8 @@ extension XCTestCase {
matching: viewController,
as: .image(
on: device.imageConfig,
subpixelThreshold: subpixelThreshold,
precision: precision,
perceptualPrecision: perceptualPrecision,
traits: traits
),
named: name,
Expand Down