Skip to content

Commit 0efeef4

Browse files
committed
Fixed bug in threshold calculation
1 parent 67324cb commit 0efeef4

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
@@ -103,7 +103,7 @@ private func compare(_ old: UIImage, _ new: UIImage, precision: Float, subpixelT
103103
if memcmp(oldData, newerData, byteCount) == 0 { return true }
104104
if precision >= 1 && subpixelThreshold == 0 { return false }
105105
var differentPixelCount = 0
106-
let threshold = Int(1.0 - precision * Float(byteCount))
106+
let threshold = Int(round((1.0 - precision) * Float(byteCount)))
107107

108108
var byte = 0
109109
while byte < byteCount {

0 commit comments

Comments
 (0)