Skip to content
This repository was archived by the owner on Jul 12, 2024. It is now read-only.

Commit 441fd5b

Browse files
pimmsanjones-seek
authored andcommitted
Fixed bug in threshold calculation
1 parent 4a7fa62 commit 441fd5b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/SnapshotTesting/Snapshotting/UIImage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private func compare(_ old: UIImage, _ new: UIImage, precision: Float, pixelDiff
112112
if memcmp(oldData, newerData, byteCount) == 0 { return true }
113113
if precision >= 1 && subpixelThreshold == 0 { return false }
114114
var differentPixelCount = 0
115-
let threshold = Int(1.0 - precision * Float(byteCount))
115+
let threshold = Int(round((1.0 - precision) * Float(byteCount)))
116116

117117
var byte = 0
118118
while byte < byteCount {

0 commit comments

Comments
 (0)