diff --git a/test/fixtures/grey-plus-alpha.gif b/test/fixtures/grey-plus-alpha.gif new file mode 100644 index 00000000..7a4cb1e4 Binary files /dev/null and b/test/fixtures/grey-plus-alpha.gif differ diff --git a/test/fixtures/index.js b/test/fixtures/index.js index 57924121..73048b30 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -85,6 +85,7 @@ module.exports = { inputWebPWithTransparency: getPath('5_webp_a.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp inputTiff: getPath('G31D.TIF'), // http://www.fileformat.info/format/tiff/sample/e6c9a6e5253348f4aef6d17b534360ab/index.htm inputGif: getPath('Crash_test.gif'), // http://upload.wikimedia.org/wikipedia/commons/e/e3/Crash_test.gif + inputGifGreyPlusAlpha: getPath('grey-plus-alpha.gif'), // http://i.imgur.com/gZ5jlmE.gif inputSvg: getPath('check.svg'), // http://dev.w3.org/SVG/tools/svgweb/samples/svg-files/check.svg inputSvs: getPath('CMU-1-Small-Region.svs'), // http://openslide.cs.cmu.edu/download/openslide-testdata/Aperio/CMU-1-Small-Region.svs diff --git a/test/unit/io.js b/test/unit/io.js index 0483a8db..77d44ff7 100644 --- a/test/unit/io.js +++ b/test/unit/io.js @@ -747,6 +747,24 @@ describe('Input/output', function() { }); } + if (sharp.format.gif.input.file) { + it('Load GIF grey+alpha from file', function(done) { + sharp(fixtures.inputGifGreyPlusAlpha) + .resize(8, 4) + .png() + .toBuffer(function(err, data, info) { + if (err) throw err; + assert.strictEqual(true, data.length > 0); + assert.strictEqual(data.length, info.size); + assert.strictEqual('png', info.format); + assert.strictEqual(8, info.width); + assert.strictEqual(4, info.height); + assert.strictEqual(4, info.channels); + done(); + }); + }); + } + if (sharp.format.openslide.input.file) { it('Load Aperio SVS file via Openslide', function(done) { sharp(fixtures.inputSvs) diff --git a/test/unit/metadata.js b/test/unit/metadata.js index 66e089c8..b845fd67 100644 --- a/test/unit/metadata.js +++ b/test/unit/metadata.js @@ -150,17 +150,16 @@ describe('Image metadata', function() { done(); }); }); - } else if (sharp.format.magick.input.file) { - it('GIF via libmagick', function(done) { - sharp(fixtures.inputGif).metadata(function(err, metadata) { + it('GIF grey+alpha via giflib', function(done) { + sharp(fixtures.inputGifGreyPlusAlpha).metadata(function(err, metadata) { if (err) throw err; - assert.strictEqual('magick', metadata.format); - assert.strictEqual(800, metadata.width); - assert.strictEqual(533, metadata.height); - assert.strictEqual(3, metadata.channels); + assert.strictEqual('gif', metadata.format); + assert.strictEqual(2, metadata.width); + assert.strictEqual(1, metadata.height); + assert.strictEqual(4, metadata.channels); assert.strictEqual('undefined', typeof metadata.density); assert.strictEqual(false, metadata.hasProfile); - assert.strictEqual(false, metadata.hasAlpha); + assert.strictEqual(true, metadata.hasAlpha); assert.strictEqual('undefined', typeof metadata.orientation); assert.strictEqual('undefined', typeof metadata.exif); assert.strictEqual('undefined', typeof metadata.icc);