Skip to content

Commit ea9bc1b

Browse files
authored
Improve warning about view snapshot discrepancies (#592)
I think it's better to be conservative, as the list of variables that can cause discrepancies is incomplete and unlikely to ever be exhaustive. Other things that seem to cause differences are the architecture of the Mac running the simulator causing subtle "sub" pixel differences, and optical font sizing adjustments that either don't respect the `displayScale` UI trait or deliberately ignore it because it's truly driven by the device display's points per inch (a product of the display's scale and pixels per inch). I think a broad caution is more prudent than extending the warning to include more device characteristics, as even if that list could be complete now, it would be very hard to track.
1 parent 33dfcad commit ea9bc1b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ assertSnapshot(matching: vc, as: .image(on: .iPadMini(.portrait)))
7575
assertSnapshot(matching: vc, as: .recursiveDescription(on: .iPadMini(.portrait)))
7676
```
7777

78-
> ⚠️ Warning: Snapshots must be compared using a simulator with the same OS, device gamut, and scale as the simulator that originally took the reference to avoid discrepancies between images.
78+
> ⚠️ Warning: Snapshots must be compared using the exact same simulator that originally took the reference to avoid discrepancies between images.
7979
8080
Better yet, SnapshotTesting isn't limited to views and view controllers! There are [a number of available snapshot strategies](Documentation/Available-Snapshot-Strategies.md) to choose from.
8181

0 commit comments

Comments
 (0)