Tests: reduce CPU cost of RGBA linear test, ~2s faster

This commit is contained in:
Lovell Fuller 2023-03-21 12:42:50 +00:00
parent cd419a261b
commit f8a430bdd3
4 changed files with 6 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -43,8 +43,9 @@ 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);
});
@ -52,8 +53,9 @@ describe('Linear adjustment', function () {
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);
});
@ -61,8 +63,9 @@ describe('Linear adjustment', function () {
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);
});