mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-10 18:29:59 +01:00
* Test for GIF * some cleanup * Some cleanup * Some code cleanup * cleanup Co-authored-by: Jeffrey Warren <jeff@unterbahn.com> Co-authored-by: Rishabh Shukla <42492389+blurry-x-face@users.noreply.github.com> Co-authored-by: Harsh Khandeparkar <34770591+HarshKhandeparkar@users.noreply.github.com>
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
const test = require('tape'),
|
|
base64Img = require('base64-img');
|
|
|
|
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`);
|
|
|
|
t.equal(result === benchmark, true, `${moduleName} module works correctly with Gif`);
|
|
sequencer = null;
|
|
t.end();
|
|
});
|
|
});
|
|
}; |