Skip to content

Commit 2d18e61

Browse files
committed
Workaround for false negatives for exactly matching images
1 parent c6fd362 commit 2d18e61

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/unit/visual/visualTest.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ window.checkMatch = function(actual, expected, p5) {
5959
Math.ceil(img.height * scale)
6060
);
6161
}
62+
// The below algorithm to calculate differences can produce false negatives in certain cases.
63+
// Immediately return true for exact matches.
64+
if (toBase64(expected) === toBase64(actual)) {
65+
return { ok: true };
66+
}
6267
const diff = p5.createImage(actual.width, actual.height);
6368
diff.drawingContext.drawImage(actual.canvas, 0, 0);
6469
diff.drawingContext.globalCompositeOperation = 'difference';

0 commit comments

Comments
 (0)