Doc refresh, changelog and dead code removal for #977

This commit is contained in:
Lovell Fuller
2017-10-10 20:16:38 +01:00
parent d0f66c3734
commit 3c88c84998
9 changed files with 51 additions and 155 deletions

View File

@@ -478,4 +478,40 @@ describe('Resize dimensions', function () {
fixtures.assertSimilar(fixtures.expected('fast-shrink-on-load-true.png'), data, done);
});
});
[
sharp.kernel.nearest,
sharp.kernel.cubic,
sharp.kernel.lanczos2,
sharp.kernel.lanczos3
].forEach(function (kernel) {
it(`kernel ${kernel}`, function (done) {
sharp(fixtures.inputJpg)
.resize(320, null, { kernel: kernel })
.toBuffer(function (err, data, info) {
if (err) throw err;
assert.strictEqual('jpeg', info.format);
assert.strictEqual(320, info.width);
fixtures.assertSimilar(fixtures.inputJpg, data, done);
});
});
});
it('nearest upsampling with integral factor', function (done) {
sharp(fixtures.inputTiff8BitDepth)
.resize(210, 210, { kernel: 'nearest' })
.png()
.toBuffer(function (err, data, info) {
if (err) throw err;
assert.strictEqual(210, info.width);
assert.strictEqual(210, info.height);
done();
});
});
it('unknown kernel throws', function () {
assert.throws(function () {
sharp().resize(null, null, { kernel: 'unknown' });
});
});
});