Skip to content

Commit

Permalink
Tests: add assertion to existing scenario #3357
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Sep 29, 2022
1 parent 891cf67 commit 1b0eb6a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions test/unit/png.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,25 @@ describe('PNG', function () {
assert.strictEqual(alphaMeanAfter, alphaMeanBefore);
});

it('palette decode/encode roundtrip', () =>
sharp(fixtures.inputPngPalette)
it('palette decode/encode roundtrip', async () => {
const data = await sharp(fixtures.inputPngPalette)
.png({ effort: 1, palette: true })
.toBuffer()
);
.toBuffer();

const { size, ...metadata } = await sharp(data).metadata();
assert.deepStrictEqual(metadata, {
format: 'png',
width: 68,
height: 68,
space: 'srgb',
channels: 3,
depth: 'uchar',
isProgressive: false,
paletteBitDepth: 8,
hasProfile: false,
hasAlpha: false
});
});

it('Valid PNG libimagequant palette value does not throw error', function () {
assert.doesNotThrow(function () {
Expand Down

0 comments on commit 1b0eb6a

Please sign in to comment.