Let libvips check whether we received a valid image or not

This removes the custom image fingerprinting code and uses the libvips
is_a_buffer() infrastructure instead.
This commit is contained in:
Maurus Cuelenaere
2015-02-15 21:44:12 +01:00
parent 3ca2f009f4
commit 125ee836fe
3 changed files with 35 additions and 63 deletions

View File

@@ -202,27 +202,23 @@ describe('Input/output', function() {
});
it('Fail when input is empty Buffer', function(done) {
var failed = true;
try {
sharp(new Buffer(0));
failed = false;
} catch (err) {
sharp(new Buffer(0)).toBuffer().then(function () {
assert(false);
done();
}).catch(function (err) {
assert(err instanceof Error);
}
assert(failed);
done();
done();
});
});
it('Fail when input is invalid Buffer', function(done) {
var failed = true;
try {
sharp(new Buffer([0x1, 0x2, 0x3, 0x4]));
failed = false;
} catch (err) {
sharp(new Buffer([0x1, 0x2, 0x3, 0x4])).toBuffer().then(function () {
assert(false);
done();
}).catch(function (err) {
assert(err instanceof Error);
}
assert(failed);
done();
done();
});
});
it('Promises/A+', function(done) {