Skip to content

Commit

Permalink
use view name for activity
Browse files Browse the repository at this point in the history
  • Loading branch information
paulz committed May 29, 2022
1 parent fc170b6 commit 2580b44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/verifySnapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public func verifySnapshot<V: View>(_ view: V, _ name: String? = nil, colorAccur
XCTFail("failed to get image data")
return
}
let fileName = (name ?? "\(V.self)") + ".png"
let viewName = name ?? "\(V.self)"
let fileName = viewName + ".png"
let url = folderUrl(String(describing: file)).appendingPathComponent(fileName)

func writeActual(onFailure: String) {
Expand All @@ -53,7 +54,7 @@ public func verifySnapshot<V: View>(_ view: V, _ name: String? = nil, colorAccur
}

if let expectedData = try? Data(contentsOf: url), let expectedImage = UIImage(data: expectedData) {
XCTContext.runActivity(named: "compare images") {
XCTContext.runActivity(named: viewName) {
let actualImage = XCTAttachment(data: pngData, uniformTypeIdentifier: UTType.png.identifier)
actualImage.name = "actual image"
$0.add(actualImage)
Expand Down

0 comments on commit 2580b44

Please sign in to comment.