Skip to content

Commit

Permalink
test: Update PNG format tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor-pelykh committed Feb 3, 2024
1 parent 555e2fa commit 94d2abd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Binary file added test/_input/png/png_LA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions test/format/format.png.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,37 @@ describe('Format: PNG', () => {
const buck24Hash = 817446904;
let buck24Image: MemoryImage | undefined = undefined;

test('luminanceAlpha', () => {
const input = TestUtils.readFromFile(
TestFolder.input,
TestSection.png,
'png_LA.png'
);
const png = decodePng({
data: input,
});
expect(png).toBeDefined();
if (png === undefined) {
return;
}

expect(png.numChannels).toBe(2);

const rgba = png.convert({
numChannels: 4,
});

const output = encodePng({
image: rgba,
});
TestUtils.writeToFile(
TestFolder.output,
TestSection.png,
'png_LA_rgba.png',
output
);
});

test('hungry_180', () => {
const input = TestUtils.readFromFile(
TestFolder.input,
Expand Down

0 comments on commit 94d2abd

Please sign in to comment.