Skip to content

Commit

Permalink
test(CssFilters): Avoid asserting 4000 times
Browse files Browse the repository at this point in the history
  • Loading branch information
bruyeret committed Feb 8, 2024
1 parent 717bf4f commit 1cb6e29
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('Test CssFilters brightness', (t) => {
t.end();
});

test('Fuzzy test all CssFilters', (t) => {
test.only('Fuzzy test all CssFilters', (t) => {
const canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = 1;
Expand Down Expand Up @@ -59,7 +59,10 @@ test('Fuzzy test all CssFilters', (t) => {
const error = referenceOutput[channel] - filtersOutput[channel];
// The error depends on the values of each filter
// For example, using a color of [127.5, 127.5, 128.49] with a saturate of 1000 creates big errors
t.assert(Math.abs(error) <= 7 / 255);
// This is because the CSS filters use uint8 instead of floating point numbers
if (Math.abs(error) > 7 / 255) {
t.fail('Error is too big');
}
}
}
t.end();
Expand Down

0 comments on commit 1cb6e29

Please sign in to comment.