mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-15 21:00:02 +01:00
* fixes #269 Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update demo Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * refactor and comments Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update readme Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * updated and refactored Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update readme Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * trying to fix tests Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update documentation Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update to config.mode = test Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * finaly everything works Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * 1.8.0 * update test Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * add test for run Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
29 lines
1.4 KiB
JavaScript
29 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
var fs = require('fs');
|
|
var test = require('tape');
|
|
var DataURItoBuffer = require('data-uri-to-buffer');
|
|
|
|
require('../../src/ImageSequencer.js');
|
|
|
|
var sequencer = ImageSequencer({ ui: false });
|
|
var red = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z";
|
|
|
|
sequencer.loadImages('image1', red);
|
|
sequencer.addSteps('invert');
|
|
sequencer.addSteps('invert');
|
|
sequencer.addSteps('invert');
|
|
|
|
test('run() works with all possible argument combinations',function(t){
|
|
sequencer.run(function (out) {
|
|
var output1 = DataURItoBuffer(sequencer.images.image1.steps.slice(-1)[0].output.src);
|
|
sequencer.images.image1.steps.splice(1,1);
|
|
sequencer.run({index: 1},function(out){
|
|
var output2 = DataURItoBuffer(sequencer.images.image1.steps.slice(-1)[0].output.src);
|
|
t.deepEqual(output1,output2,"output remains same after removing a step and running sequencer from a greater index");
|
|
sequencer.run(function(out){
|
|
t.end();
|
|
})
|
|
});
|
|
});
|
|
}); |