Skip to content

Commit

Permalink
Tests: reduce CPU cost of RGBA linear test, ~2s faster
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Mar 21, 2023
1 parent cd419a2 commit f8a430b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Binary file modified test/fixtures/expected/alpha-layer-1-fill-linear.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/expected/alpha-layer-1-fill-offset.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/expected/alpha-layer-1-fill-slope.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions test/unit/linear.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,29 @@ describe('Linear adjustment', function () {

it('applies linear levels adjustment w alpha ch', function (done) {
sharp(fixtures.inputPngOverlayLayer1)
.resize(240)
.linear(a, b)
.toBuffer(function (err, data, info) {
.toBuffer(function (err, data) {
if (err) throw err;
fixtures.assertSimilar(fixtures.expected('alpha-layer-1-fill-linear.png'), data, done);
});
});

it('applies slope level adjustment w alpha ch', function (done) {
sharp(fixtures.inputPngOverlayLayer1)
.resize(240)
.linear(a)
.toBuffer(function (err, data, info) {
.toBuffer(function (err, data) {
if (err) throw err;
fixtures.assertSimilar(fixtures.expected('alpha-layer-1-fill-slope.png'), data, done);
});
});

it('applies offset level adjustment w alpha ch', function (done) {
sharp(fixtures.inputPngOverlayLayer1)
.resize(240)
.linear(null, b)
.toBuffer(function (err, data, info) {
.toBuffer(function (err, data) {
if (err) throw err;
fixtures.assertSimilar(fixtures.expected('alpha-layer-1-fill-offset.png'), data, done);
});
Expand Down

0 comments on commit f8a430b

Please sign in to comment.