mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Upgrade to libvips 8.10.5, AVIF support in prebuilt binaries
Remove experimental status from HEIF, changing defaults to prefer royalty-free AV1 over patent-encumbered HEVC
This commit is contained in:
@@ -4,76 +4,65 @@ const assert = require('assert');
|
||||
|
||||
const sharp = require('../../');
|
||||
|
||||
const formatHeifOutputBuffer = sharp.format.heif.output.buffer;
|
||||
|
||||
describe('HEIF (experimental)', () => {
|
||||
describe('Stubbed without support for HEIF', () => {
|
||||
before(() => {
|
||||
sharp.format.heif.output.buffer = false;
|
||||
});
|
||||
after(() => {
|
||||
sharp.format.heif.output.buffer = formatHeifOutputBuffer;
|
||||
});
|
||||
|
||||
it('should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif();
|
||||
});
|
||||
describe('HEIF', () => {
|
||||
it('called without options does not throw an error', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
sharp().heif();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Stubbed with support for HEIF', () => {
|
||||
before(() => {
|
||||
sharp.format.heif.output.buffer = true;
|
||||
it('valid quality does not throw an error', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
sharp().heif({ quality: 80 });
|
||||
});
|
||||
after(() => {
|
||||
sharp.format.heif.output.buffer = formatHeifOutputBuffer;
|
||||
});
|
||||
it('invalid quality should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ quality: 101 });
|
||||
});
|
||||
|
||||
it('called without options does not throw an error', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
sharp().heif();
|
||||
});
|
||||
});
|
||||
it('non-numeric quality should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ quality: 'fail' });
|
||||
});
|
||||
it('valid quality does not throw an error', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
sharp().heif({ quality: 50 });
|
||||
});
|
||||
});
|
||||
it('valid lossless does not throw an error', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
sharp().heif({ lossless: true });
|
||||
});
|
||||
it('invalid quality should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ quality: 101 });
|
||||
});
|
||||
});
|
||||
it('non-boolean lossless should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ lossless: 'fail' });
|
||||
});
|
||||
it('non-numeric quality should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ quality: 'fail' });
|
||||
});
|
||||
});
|
||||
it('valid compression does not throw an error', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
sharp().heif({ compression: 'hevc' });
|
||||
});
|
||||
it('valid lossless does not throw an error', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
sharp().heif({ lossless: true });
|
||||
});
|
||||
});
|
||||
it('unknown compression should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ compression: 'fail' });
|
||||
});
|
||||
it('non-boolean lossless should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ lossless: 'fail' });
|
||||
});
|
||||
});
|
||||
it('invalid compression should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ compression: 1 });
|
||||
});
|
||||
it('valid compression does not throw an error', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
sharp().heif({ compression: 'avc' });
|
||||
});
|
||||
});
|
||||
it('valid speed does not throw an error', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
sharp().heif({ speed: 6 });
|
||||
});
|
||||
it('unknown compression should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ compression: 'fail' });
|
||||
});
|
||||
});
|
||||
it('out of range speed should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ speed: 9 });
|
||||
});
|
||||
it('invalid compression should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ compression: 1 });
|
||||
});
|
||||
});
|
||||
it('invalid speed should throw an error', () => {
|
||||
assert.throws(() => {
|
||||
sharp().heif({ compression: 'fail' });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user