mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-11 10:49:59 +01:00
* try moving to Github Actions from Travis for CI * npm install * add apt-get prereqs * Update continuous-integration.yml * Update .github/workflows/continuous-integration.yml Co-authored-by: Barun Acharya <47106543+daemon1024@users.noreply.github.com> * use resemblejs in gif-tests * trying `npm run setup` * fix: use ubuntu latest for github actions Co-authored-by: Barun Acharya <47106543+daemon1024@users.noreply.github.com> * Update .github/workflows/continuous-integration.yml * fix: try more changes - fix: install `libcairo2-dev` explicitly with apt. - fix: use Ubuntu 18.04 * fix<actions>: merge dependency installs in one command * fix<actions>: include more dependencies * GitHub actions running parallel (#1787) * try running tests parallely * setup composite actions * Update continuous-integration.yml * setup all jobs * just install instead of setup * trying ci without ubuntu package deps * cache node modules in ci * remove action.yml * name change for brevity * add recommended deps for tape-run * xvfb-run --auto-servernum npm run core-tests Co-authored-by: Barun Acharya <47106543+daemon1024@users.noreply.github.com> Co-authored-by: daemon1024 <barun1024@gmail.com> Co-authored-by: Harsh Khandeparkar <34770591+HarshKhandeparkar@users.noreply.github.com>
54 lines
1.5 KiB
JavaScript
54 lines
1.5 KiB
JavaScript
const test = require('tape'),
|
|
base64Img = require('base64-img');
|
|
|
|
const compare = require('resemblejs').compare;
|
|
|
|
const ImageSequencer = require('../../../src/ImageSequencer');
|
|
|
|
const test_gif = require('../images/test.gif.js');
|
|
target = 'test_outputs';
|
|
|
|
/**
|
|
* @method ModuleTest.
|
|
* @description a common test for modules.
|
|
* @param {String} moduleName name of the module.
|
|
* @param {"Object"} options module options.
|
|
* @param {String} benchmark dataURI of the benchmark gif.
|
|
* @param {String} [input="test_gif"] optional input image. Default is a test gif.
|
|
*/
|
|
module.exports = (moduleName, options, benchmark, input) => {
|
|
let sequencer = ImageSequencer({ ui: false });
|
|
sequencer.loadImages(input || test_gif);
|
|
sequencer.addSteps(moduleName, options);
|
|
test(`${moduleName} module works correctly`, (t) => {
|
|
sequencer.run({ mode: 'test' }, () => {
|
|
let result = sequencer.steps[1].output.src;
|
|
|
|
base64Img.imgSync(result, target, `${moduleName}-result`);
|
|
base64Img.imgSync(benchmark, target, `${moduleName}-benchmark`);
|
|
|
|
let mismatch = 100;
|
|
compare(
|
|
result,
|
|
benchmark,
|
|
{ returnEarlyThreshold: 5 },
|
|
(err, { rawMisMatchPercentage }) => {
|
|
if (err) {
|
|
console.log('An error while comparing!');
|
|
} else {
|
|
mismatch = rawMisMatchPercentage;
|
|
}
|
|
}
|
|
);
|
|
|
|
t.equal(
|
|
mismatch < 5,
|
|
true,
|
|
`${moduleName} module works correctly with Gif`
|
|
);
|
|
sequencer = null;
|
|
t.end();
|
|
});
|
|
});
|
|
};
|