mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Tests: add PNG palette decode/encode roundtrip
This commit is contained in:
parent
e1ba2a7fd8
commit
336856dfc2
1
test/fixtures/index.js
vendored
1
test/fixtures/index.js
vendored
@ -93,6 +93,7 @@ module.exports = {
|
|||||||
inputPngImageInAlpha: getPath('image-in-alpha.png'), // https://github.com/lovell/sharp/issues/1597
|
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
|
inputPngSolidAlpha: getPath('with-alpha.png'), // https://github.com/lovell/sharp/issues/1599
|
||||||
inputPngP3: getPath('p3.png'), // https://github.com/lovell/sharp/issues/2862
|
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
|
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
|
inputWebPWithTransparency: getPath('5_webp_a.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp
|
||||||
|
BIN
test/fixtures/swiss.png
vendored
Normal file
BIN
test/fixtures/swiss.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
@ -128,6 +128,12 @@ describe('PNG', function () {
|
|||||||
assert.strictEqual(alphaMeanAfter, alphaMeanBefore);
|
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 () {
|
it('Valid PNG libimagequant palette value does not throw error', function () {
|
||||||
assert.doesNotThrow(function () {
|
assert.doesNotThrow(function () {
|
||||||
sharp().png({ palette: false });
|
sharp().png({ palette: false });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user