mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Expose WebP smartDeblock output option
This commit is contained in:
@@ -102,6 +102,29 @@ describe('WebP', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('can produce a different file size using smartDeblock', () =>
|
||||
sharp(fixtures.inputPngOverlayLayer0)
|
||||
.resize(320, 240)
|
||||
.webp({ quality: 30, smartDeblock: false })
|
||||
.toBuffer()
|
||||
.then(withoutSmartDeblock =>
|
||||
sharp(fixtures.inputPngOverlayLayer0)
|
||||
.resize(320, 240)
|
||||
.webp({ quality: 30, smartDeblock: true })
|
||||
.toBuffer()
|
||||
.then(withSmartDeblock => {
|
||||
assert.strictEqual(true, withSmartDeblock.length !== withoutSmartDeblock.length);
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
it('invalid smartDeblock throws', () => {
|
||||
assert.throws(
|
||||
() => sharp().webp({ smartDeblock: 1 }),
|
||||
/Expected boolean for webpSmartDeblock but received 1 of type number/
|
||||
);
|
||||
});
|
||||
|
||||
it('should produce a different file size with specific preset', () =>
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
|
||||
Reference in New Issue
Block a user