Skip to content

Commit

Permalink
fix failing unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanMOlson committed Oct 20, 2024
1 parent 279c915 commit 076dee0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ function colorDelta(img1, img2, k, m, yOnly) {

if (a1 === a2 && r1 === r2 && g1 === g2 && b1 === b2 && a1 === a2) return 0;

const rBackground = 64 + 128 * (k % 2);
const gBackground = 64 + 128 * (Math.floor(k / 2) % 2);
const bBackground = 64 + 128 * (Math.floor(k / 4) % 2);
const rBackground = 48 + 159 * (k % 2);
const gBackground = 48 + 159 * (Math.floor(k / 2) % 2);
const bBackground = 48 + 159 * (Math.floor(k / 4) % 2);

if (a1 < 255) {
a1 /= 255;
Expand Down
Binary file modified test/fixtures/5diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ diffTest('2a', '2b', '2diff', {
}, 12437);
diffTest('3a', '3b', '3diff', options, 212);
diffTest('4a', '4b', '4diff', options, 36049);
diffTest('5a', '5b', '5diff', options, 0);
diffTest('5a', '5b', '5diff', options, 8);
diffTest('6a', '6b', '6diff', options, 51);
diffTest('6a', '6a', '6empty', {threshold: 0}, 0);
diffTest('7a', '7b', '7diff', {diffColorAlt: [0, 255, 0]}, 2448);
Expand Down

0 comments on commit 076dee0

Please sign in to comment.