diff --git a/src/ImageSequencer.js b/src/ImageSequencer.js index 2d22ddfb..97a6255d 100644 --- a/src/ImageSequencer.js +++ b/src/ImageSequencer.js @@ -141,7 +141,9 @@ ImageSequencer = function ImageSequencer(options) { if(args.length==1) { if (objTypeOf(args[0])=="Object") { //removeSteps(JSON) - json_q = args[0]; + for (img in args[0]) { + json_q[img] = makeArray(args[0][img]); + } } else { //removeSteps(index) => removeSteps([image],[index]) args.splice(0,0,[]); diff --git a/src/modules/FishEye.js b/src/modules/FishEye.js new file mode 100644 index 00000000..1045ee80 --- /dev/null +++ b/src/modules/FishEye.js @@ -0,0 +1,23 @@ +/* + * Display only the green channel + */ +module.exports = function FishEye(options) { + + options = options || {}; + options.title = "Fish Eye"; + options.description = "Corrects fish eye or barrel distortion."; + var output; + + //function setup() {} // optional + + function draw(input,callback) { + + } + + return { + options: options, + //setup: setup, // optional + draw: draw, + output: output + } +} diff --git a/test/image-sequencer.js b/test/image-sequencer.js index 4788963f..83f06fcc 100644 --- a/test/image-sequencer.js +++ b/test/image-sequencer.js @@ -10,20 +10,12 @@ require('../src/ImageSequencer.js'); var sequencer = ImageSequencer({ ui: "none" }); -//function read (file) { -// return fs.readFileSync('./test/fixtures/' + file, 'utf8').trim(); -//} - -//function write (file, data) { /* jshint ignore:line */ -// return fs.writeFileSync('./test/fixtures/' + file, data + '\n', 'utf8'); -//} - test('Image Sequencer has tests', function (t) { t.equal(true, true); t.end(); }); -test('loadImages loads a step', function (t){ +test('loadImages loads an image and creates a step.', function (t){ sequencer.loadImages('test','examples/red.jpg'); t.equal(sequencer.images.test.steps.length, 1, "It Does!"); t.end(); @@ -65,16 +57,54 @@ test('addSteps("image","name",o) adds a step', function (t) { t.end(); }); - -test('removeSteps removes a step', function (t) { +test('removeSteps("image",position) removes a step', function (t) { sequencer.removeSteps('test',1); t.equal(sequencer.images.test.steps.length, 6, "It Does!"); t.end(); }); -test('insertStep inserts a step', function (t) { - sequencer.insertSteps('test',1,'do-nothing'); - t.equal(sequencer.images.test.steps[1].options.name, "do-nothing"); - t.equal(sequencer.images.test.steps.length, 7, "It Does!"); +test('removeSteps({image: [positions]}) removes steps', function (t) { + sequencer.removeSteps('test',[1,2]); + t.equal(sequencer.images.test.steps.length, 4, "It Does!"); + t.end(); +}); + +test('removeSteps(position) removes steps', function (t) { + sequencer.removeSteps([1,2]); + t.equal(sequencer.images.test.steps.length, 2, "It Does!"); + t.end(); +}); + +test('insertSteps("image",position,"module",options) inserts a step', function (t) { + sequencer.insertSteps('test',1,'do-nothing',{}); + t.equal(sequencer.images.test.steps[1].options.name, "do-nothing"); + t.equal(sequencer.images.test.steps.length, 3, "It Does!"); + t.end(); +}); + +test('insertSteps("image",position,"module") inserts a step', function (t) { + sequencer.insertSteps('test',1,'do-nothing'); + t.equal(sequencer.images.test.steps[1].options.name, "do-nothing"); + t.equal(sequencer.images.test.steps.length, 4, "It Does!"); + t.end(); +}); + +test('insertSteps(position,"module") inserts a step', function (t) { + sequencer.insertSteps(1,'do-nothing'); + t.equal(sequencer.images.test.steps[1].options.name, "do-nothing"); + t.equal(sequencer.images.test.steps.length, 5, "It Does!"); + t.end(); +}); + +test('insertSteps({image: {index: index, name: "module", o: options} }) inserts a step', function (t) { + sequencer.insertSteps({test: {index:1, name:'do-nothing', o:{} } }); + t.equal(sequencer.images.test.steps[1].options.name, "do-nothing"); + t.equal(sequencer.images.test.steps.length, 6, "It Does!"); + t.end(); +}); + +test('run() runs the sequencer', function (t) { + sequencer.run(); + t.equal(typeof(sequencer.images.test.steps[sequencer.images.test.steps.length - 1].output), "object", "It Does!"); t.end(); });