diff --git a/CriticalMaps.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/CriticalMaps.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index d43b506f..eedec700 100644 --- a/CriticalMaps.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/CriticalMaps.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -139,8 +139,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-snapshot-testing.git", "state" : { - "revision" : "c097f955b4e724690f0fc8ffb7a6d4b881c9c4e3", - "version" : "1.17.2" + "revision" : "6d932a79e7173b275b96c600c86c603cf84f153c", + "version" : "1.17.4" } }, { diff --git a/CriticalMapsKit/Sources/TestHelper/XCTestCase+Additions.swift b/CriticalMapsKit/Sources/TestHelper/XCTestCase+Additions.swift index db6fea15..753aa8e0 100644 --- a/CriticalMapsKit/Sources/TestHelper/XCTestCase+Additions.swift +++ b/CriticalMapsKit/Sources/TestHelper/XCTestCase+Additions.swift @@ -7,9 +7,9 @@ private let operatingSystemVersion = ProcessInfo().operatingSystemVersion public extension XCTestCase { private func enforceSnapshotDevice() { let is2XDevice = UIScreen.main.scale >= 2 - let isMinVersion14 = operatingSystemVersion.majorVersion >= 15 + let isMinVersion16 = operatingSystemVersion.majorVersion >= 16 - guard is2XDevice, isMinVersion14 else { + guard is2XDevice, isMinVersion16 else { fatalError("Screenshot test device should use @2x screen scale and iOS 14.4") } } @@ -48,6 +48,7 @@ public extension XCTestCase { func assertViewSnapshot( _ view: V, height: CGFloat? = nil, + width: CGFloat = 375, sloppy: Bool = false, file: StaticString = #file, testName: String = #function, @@ -57,16 +58,18 @@ public extension XCTestCase { var layout = SwiftUISnapshotLayout.device(config: .iPhone8) if let height = height { - layout = .fixed(width: 375, height: height) + layout = .fixed(width: width, height: height) } let precision: Float = (sloppy ? XCTestCase.sloppyPrecision : 1) - assertSnapshot( - matching: view, - as: .image(precision: precision, layout: layout), - file: file, - testName: testName, - line: line - ) + withSnapshotTesting(diffTool: .ksdiff) { + assertSnapshot( + of: view, + as: .image(precision: precision, layout: layout), + file: file, + testName: testName, + line: line + ) + } } } diff --git a/CriticalMapsKit/Tests/MapFeatureTests/UserTrackingButtonSnapshotTests.swift b/CriticalMapsKit/Tests/MapFeatureTests/UserTrackingButtonSnapshotTests.swift index 17556fd9..a3a5bc3b 100644 --- a/CriticalMapsKit/Tests/MapFeatureTests/UserTrackingButtonSnapshotTests.swift +++ b/CriticalMapsKit/Tests/MapFeatureTests/UserTrackingButtonSnapshotTests.swift @@ -12,7 +12,7 @@ final class UserTrackingButtonSnapshotTests: XCTestCase { ) ) - assertViewSnapshot(sut, height: 60, sloppy: true) + assertViewSnapshot(sut, height: 60, width: 60, sloppy: true) } @MainActor @@ -24,7 +24,7 @@ final class UserTrackingButtonSnapshotTests: XCTestCase { ) ) - assertViewSnapshot(sut, height: 60, sloppy: true) + assertViewSnapshot(sut, height: 60, width: 60, sloppy: true) } @MainActor @@ -36,6 +36,6 @@ final class UserTrackingButtonSnapshotTests: XCTestCase { ) ) - assertViewSnapshot(sut, height: 60, sloppy: true) + assertViewSnapshot(sut, height: 60, width: 60, sloppy: true) } } diff --git a/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_follow.1.png b/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_follow.1.png index 302c087e..6562ad64 100644 Binary files a/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_follow.1.png and b/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_follow.1.png differ diff --git a/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_followWithHeading.1.png b/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_followWithHeading.1.png index 19a0e94c..8927498b 100644 Binary files a/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_followWithHeading.1.png and b/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_followWithHeading.1.png differ diff --git a/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_none.1.png b/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_none.1.png index a64382b5..fd8ab312 100644 Binary files a/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_none.1.png and b/CriticalMapsKit/Tests/MapFeatureTests/__Snapshots__/UserTrackingButtonSnapshotTests/test_userTracking_none.1.png differ