mirror of
https://github.com/lovell/sharp.git
synced 2025-07-11 11:30:15 +02:00
Add WebP availability check to test added in a5bd68e
This commit is contained in:
parent
a5bd68ef8c
commit
9ddc817a09
@ -128,26 +128,28 @@ describe('Resize dimensions', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('WebP shrink-on-load rounds to zero, ensure recalculation is correct', function(done) {
|
if (sharp.format.webp.output.buffer) {
|
||||||
sharp(fixtures.inputJpg)
|
it('WebP shrink-on-load rounds to zero, ensure recalculation is correct', function(done) {
|
||||||
.resize(1080, 607)
|
sharp(fixtures.inputJpg)
|
||||||
.webp()
|
.resize(1080, 607)
|
||||||
.toBuffer(function(err, data, info) {
|
.webp()
|
||||||
if (err) throw err;
|
.toBuffer(function(err, data, info) {
|
||||||
assert.strictEqual('webp', info.format);
|
if (err) throw err;
|
||||||
assert.strictEqual(1080, info.width);
|
assert.strictEqual('webp', info.format);
|
||||||
assert.strictEqual(607, info.height);
|
assert.strictEqual(1080, info.width);
|
||||||
sharp(data)
|
assert.strictEqual(607, info.height);
|
||||||
.resize(233, 131)
|
sharp(data)
|
||||||
.toBuffer(function(err, data, info) {
|
.resize(233, 131)
|
||||||
if (err) throw err;
|
.toBuffer(function(err, data, info) {
|
||||||
assert.strictEqual('webp', info.format);
|
if (err) throw err;
|
||||||
assert.strictEqual(233, info.width);
|
assert.strictEqual('webp', info.format);
|
||||||
assert.strictEqual(131, info.height);
|
assert.strictEqual(233, info.width);
|
||||||
done();
|
assert.strictEqual(131, info.height);
|
||||||
});
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (sharp.format.tiff.input.file) {
|
if (sharp.format.tiff.input.file) {
|
||||||
it('TIFF embed known to cause rounding errors', function(done) {
|
it('TIFF embed known to cause rounding errors', function(done) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user