Skip to content

Commit

Permalink
test: New test for converting PNG with palette to ICO using the vigne…
Browse files Browse the repository at this point in the history
…tte filter
  • Loading branch information
yegor-pelykh committed May 13, 2024
1 parent 1231f41 commit 65e36a6
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/format/format.ico.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,54 @@
import {
ColorRgb8,
decodeIco,
decodePng,
encodeGif,
encodeIco,
encodeIcoImages,
encodePng,
Filter,
Format,
MemoryImage,
Transform,
} from '../../src';
import { TestFolder } from '../_utils/test-folder';
import { TestSection } from '../_utils/test-section';
import { TestUtils } from '../_utils/test-utils';

describe('Format: ICO', () => {
test('encode palette', () => {
const input = TestUtils.readFromFile(
TestFolder.input,
TestSection.png,
'buck_8.png'
);
let image = decodePng({
data: input,
});
expect(image).toBeDefined();
if (image === undefined) {
return;
}

image = Transform.copyResize({
image: image,
width: 256,
});
image = Filter.vignette({
image: image,
});

const output = encodeIco({
image: image,
});
TestUtils.writeToFile(
TestFolder.output,
TestSection.ico,
`buck_8.ico`,
output
);
});

test('encode', () => {
const image = new MemoryImage({
width: 64,
Expand Down

0 comments on commit 65e36a6

Please sign in to comment.