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-take-2 #8

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
13 changes: 11 additions & 2 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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this, when both us and the GitHub runner are using arm?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trying to make sure it runs well with a bit of leeway, if it does, will try to drop it 🙂
perceptualPrecision should be on though. if it works as advertised, it will not hurt and maybe save someone's time down the line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to work!
finn-no/FinniversKit#1345

file: StaticString = #file,
line: UInt = #line
) {
Expand All @@ -52,6 +55,8 @@ extension XCTestCase {
record: record,
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