Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit efced40

Browse files
committed
Add libwebp test
1 parent e065dda commit efced40

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

wasm/tests/data

wasm/tests/libwebp.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
const { TIMEOUT } = require('./config');
4+
const { runFFmpeg } = require('./utils');
5+
const IN_FILE_NAME = 'image.png';
6+
const OUT_FILE_NAME = 'image.webp';
7+
const FILE_SIZE = 6376;
8+
let pngData = null;
9+
10+
beforeAll(() => {
11+
pngData = Uint8Array.from(fs.readFileSync(path.join(__dirname, 'data', IN_FILE_NAME)));
12+
});
13+
14+
test('transcode png to webp', async () => {
15+
const args = ['-i', IN_FILE_NAME, OUT_FILE_NAME];
16+
const { fileSize } = await runFFmpeg(IN_FILE_NAME, pngData, args, OUT_FILE_NAME);
17+
expect(fileSize).toBe(FILE_SIZE);
18+
}, TIMEOUT);

0 commit comments

Comments
 (0)