mirror of
https://github.com/lovell/sharp.git
synced 2026-02-04 05:36:18 +01:00
Remove previously-deprecated properties from API
This commit is contained in:
@@ -54,23 +54,6 @@ describe('failOn', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('deprecated failOnError', () => {
|
||||
assert.doesNotThrow(
|
||||
() => sharp({ failOnError: true })
|
||||
);
|
||||
assert.doesNotThrow(
|
||||
() => sharp({ failOnError: false })
|
||||
);
|
||||
assert.throws(
|
||||
() => sharp({ failOnError: 'zoinks' }),
|
||||
/Expected boolean for failOnError but received zoinks of type string/
|
||||
);
|
||||
assert.throws(
|
||||
() => sharp({ failOnError: 1 }),
|
||||
/Expected boolean for failOnError but received 1 of type number/
|
||||
);
|
||||
});
|
||||
|
||||
it('returns errors to callback for truncated JPEG', (_t, done) => {
|
||||
sharp(fixtures.inputJpgTruncated, { failOn: 'truncated' }).toBuffer((err, data, info) => {
|
||||
assert.ok(err.message.includes('VipsJpeg: premature end of'), err);
|
||||
|
||||
@@ -154,7 +154,6 @@ describe('PNG', () => {
|
||||
isProgressive: false,
|
||||
isPalette: true,
|
||||
bitsPerSample: 8,
|
||||
paletteBitDepth: 8,
|
||||
hasProfile: false,
|
||||
hasAlpha: false
|
||||
});
|
||||
@@ -226,11 +225,10 @@ describe('PNG', () => {
|
||||
.png({ colours: 2, palette: false })
|
||||
.toBuffer();
|
||||
|
||||
const { channels, isPalette, bitsPerSample, paletteBitDepth, space } = await sharp(data).metadata();
|
||||
const { channels, isPalette, bitsPerSample, space } = await sharp(data).metadata();
|
||||
assert.strictEqual(channels, 1);
|
||||
assert.strictEqual(isPalette, false);
|
||||
assert.strictEqual(bitsPerSample, 1);
|
||||
assert.strictEqual(paletteBitDepth, undefined);
|
||||
assert.strictEqual(space, 'b-w');
|
||||
});
|
||||
|
||||
|
||||
@@ -94,24 +94,6 @@ describe('Sharpen', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('invalid sigma', () => {
|
||||
assert.throws(() => {
|
||||
sharp(fixtures.inputJpg).sharpen(-1.5);
|
||||
});
|
||||
});
|
||||
|
||||
it('invalid flat', () => {
|
||||
assert.throws(() => {
|
||||
sharp(fixtures.inputJpg).sharpen(1, -1);
|
||||
});
|
||||
});
|
||||
|
||||
it('invalid jagged', () => {
|
||||
assert.throws(() => {
|
||||
sharp(fixtures.inputJpg).sharpen(1, 1, -1);
|
||||
});
|
||||
});
|
||||
|
||||
it('invalid options.sigma', () => assert.throws(
|
||||
() => sharp().sharpen({ sigma: -1 }),
|
||||
/Expected number between 0\.000001 and 10 for options\.sigma but received -1 of type number/
|
||||
@@ -144,24 +126,23 @@ describe('Sharpen', () => {
|
||||
|
||||
it('sharpened image is larger than non-sharpened', (_t, done) => {
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.sharpen(false)
|
||||
.resize(32, 24)
|
||||
.toBuffer((err, notSharpened, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, notSharpened.length > 0);
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
assert.strictEqual(240, info.height);
|
||||
assert.strictEqual(32, info.width);
|
||||
assert.strictEqual(24, info.height);
|
||||
sharp(fixtures.inputJpg)
|
||||
.resize(320, 240)
|
||||
.sharpen(true)
|
||||
.resize(32, 24)
|
||||
.sharpen()
|
||||
.toBuffer((err, sharpened, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, sharpened.length > 0);
|
||||
assert.strictEqual(true, sharpened.length > notSharpened.length);
|
||||
assert.strictEqual('jpeg', info.format);
|
||||
assert.strictEqual(320, info.width);
|
||||
assert.strictEqual(240, info.height);
|
||||
assert.strictEqual(32, info.width);
|
||||
assert.strictEqual(24, info.height);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user