diff --git a/test/fixtures/index.js b/test/fixtures/index.js index e486934a..32c2e655 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -93,6 +93,7 @@ module.exports = { inputPngImageInAlpha: getPath('image-in-alpha.png'), // https://github.com/lovell/sharp/issues/1597 inputPngSolidAlpha: getPath('with-alpha.png'), // https://github.com/lovell/sharp/issues/1599 inputPngP3: getPath('p3.png'), // https://github.com/lovell/sharp/issues/2862 + inputPngPalette: getPath('swiss.png'), // https://github.com/randy408/libspng/issues/188 inputWebP: getPath('4.webp'), // http://www.gstatic.com/webp/gallery/4.webp inputWebPWithTransparency: getPath('5_webp_a.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp diff --git a/test/fixtures/swiss.png b/test/fixtures/swiss.png new file mode 100644 index 00000000..cf310ec6 Binary files /dev/null and b/test/fixtures/swiss.png differ diff --git a/test/unit/png.js b/test/unit/png.js index 3a8d940d..e996b514 100644 --- a/test/unit/png.js +++ b/test/unit/png.js @@ -128,6 +128,12 @@ describe('PNG', function () { assert.strictEqual(alphaMeanAfter, alphaMeanBefore); }); + it('palette decode/encode roundtrip', () => + sharp(fixtures.inputPngPalette) + .png({ effort: 1, palette: true }) + .toBuffer() + ); + it('Valid PNG libimagequant palette value does not throw error', function () { assert.doesNotThrow(function () { sharp().png({ palette: false });