mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Upgrade to libvips v8.14.0-rc1
- Replace GIF 'optimise' option with 'reuse' - Add 'progressive' option to GIF - Add 'wrap' option to text creation - Add 'formatMagick' property to *magick input metadata
This commit is contained in:
@@ -80,19 +80,36 @@ describe('GIF input', () => {
|
||||
assert.strictEqual(true, reduced.length < original.length);
|
||||
});
|
||||
|
||||
it('valid optimise', () => {
|
||||
assert.doesNotThrow(() => sharp().gif({ reoptimise: true }));
|
||||
assert.doesNotThrow(() => sharp().gif({ reoptimize: true }));
|
||||
it('valid reuse', () => {
|
||||
assert.doesNotThrow(() => sharp().gif({ reuse: true }));
|
||||
assert.doesNotThrow(() => sharp().gif({ reuse: false }));
|
||||
});
|
||||
|
||||
it('invalid reoptimise throws', () => {
|
||||
it('invalid reuse throws', () => {
|
||||
assert.throws(
|
||||
() => sharp().gif({ reoptimise: -1 }),
|
||||
/Expected boolean for gifReoptimise but received -1 of type number/
|
||||
() => sharp().gif({ reuse: -1 }),
|
||||
/Expected boolean for gifReuse but received -1 of type number/
|
||||
);
|
||||
assert.throws(
|
||||
() => sharp().gif({ reoptimize: 'fail' }),
|
||||
/Expected boolean for gifReoptimise but received fail of type string/
|
||||
() => sharp().gif({ reuse: 'fail' }),
|
||||
/Expected boolean for gifReuse but received fail of type string/
|
||||
);
|
||||
});
|
||||
|
||||
it('progressive changes file size', async () => {
|
||||
const nonProgressive = await sharp(fixtures.inputGif).gif({ progressive: false }).toBuffer();
|
||||
const progressive = await sharp(fixtures.inputGif).gif({ progressive: true }).toBuffer();
|
||||
assert(nonProgressive.length !== progressive.length);
|
||||
});
|
||||
|
||||
it('invalid progressive throws', () => {
|
||||
assert.throws(
|
||||
() => sharp().gif({ progressive: -1 }),
|
||||
/Expected boolean for gifProgressive but received -1 of type number/
|
||||
);
|
||||
assert.throws(
|
||||
() => sharp().gif({ progressive: 'fail' }),
|
||||
/Expected boolean for gifProgressive but received fail of type string/
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -294,4 +294,24 @@ describe('Text to image', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('valid wrap throws', () => {
|
||||
assert.doesNotThrow(() => sharp({ text: { text: 'text', wrap: 'none' } }));
|
||||
assert.doesNotThrow(() => sharp({ text: { text: 'text', wrap: 'wordChar' } }));
|
||||
});
|
||||
|
||||
it('invalid wrap throws', () => {
|
||||
assert.throws(
|
||||
() => sharp({ text: { text: 'text', wrap: 1 } }),
|
||||
/Expected one of: word, char, wordChar, none for text\.wrap but received 1 of type number/
|
||||
);
|
||||
assert.throws(
|
||||
() => sharp({ text: { text: 'text', wrap: false } }),
|
||||
/Expected one of: word, char, wordChar, none for text\.wrap but received false of type boolean/
|
||||
);
|
||||
assert.throws(
|
||||
() => sharp({ text: { text: 'text', wrap: 'invalid' } }),
|
||||
/Expected one of: word, char, wordChar, none for text\.wrap but received invalid of type string/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user