From ee467f2a7bbdc676a2cc786ce9f880be01f2e846 Mon Sep 17 00:00:00 2001 From: Chinmay Pandhare Date: Mon, 21 Aug 2017 10:34:50 +0530 Subject: [PATCH] Fix build --- src/modules/DecodeQr/Module.js | 1 + test/image-manip.js | 10 ++++----- test/image-sequencer.js | 38 +++++++++++++++++----------------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/modules/DecodeQr/Module.js b/src/modules/DecodeQr/Module.js index e0a55dfe..66b2532b 100644 --- a/src/modules/DecodeQr/Module.js +++ b/src/modules/DecodeQr/Module.js @@ -30,6 +30,7 @@ module.exports = function DoNothing(options,UI) { // This output is accessible to Image Sequencer step.output = input; + step.output.data = decoded; // Tell Image Sequencer that this step is complete callback(); diff --git a/test/image-manip.js b/test/image-manip.js index 3b5588d4..aeb8d4af 100644 --- a/test/image-manip.js +++ b/test/image-manip.js @@ -17,7 +17,7 @@ var test_png = require('./images/test.png.js'); var test_gif = require('./images/test.gif.js'); sequencer.loadImages(test_png); -sequencer.addSteps(['do-nothing-pix','invert','invert']); +sequencer.addSteps(['invert','invert']); test("Preload", function(t) { sequencer.run(function(){ @@ -26,8 +26,8 @@ test("Preload", function(t) { }); test("Inverted image isn't identical", function (t) { - var step1 = sequencer.images.image1.steps[1].output.src; - var step2 = sequencer.images.image1.steps[2].output.src; + var step1 = sequencer.images.image1.steps[0].output.src; + var step2 = sequencer.images.image1.steps[1].output.src; step1 = DataURItoBuffer(step1); step2 = DataURItoBuffer(step2); looksSame(step1,step2,function(err,res){ @@ -38,8 +38,8 @@ test("Inverted image isn't identical", function (t) { }); test("Twice inverted image is identical to original image", function (t) { - var step1 = sequencer.images.image1.steps[1].output.src; - var step3 = sequencer.images.image1.steps[3].output.src; + var step1 = sequencer.images.image1.steps[0].output.src; + var step3 = sequencer.images.image1.steps[2].output.src; step1 = DataURItoBuffer(step1); step3 = DataURItoBuffer(step3); looksSame(step1,step3,function(err,res){ diff --git a/test/image-sequencer.js b/test/image-sequencer.js index d5ce23b7..2f449d3f 100644 --- a/test/image-sequencer.js +++ b/test/image-sequencer.js @@ -73,38 +73,38 @@ test('loadImage works too.', function (t){ }); test('addSteps("image","name") adds a step', function (t) { - sequencer.addSteps('test','do-nothing'); + sequencer.addSteps('test','green-channel'); t.equal(sequencer.images.test.steps.length, 2, "Length of steps increased") - t.equal(sequencer.images.test.steps[1].options.name, "do-nothing", "Correct Step Added"); + t.equal(sequencer.images.test.steps[1].options.name, "green-channel", "Correct Step Added"); t.end(); }); test('addSteps("name") adds a step', function (t) { - sequencer.addSteps('do-nothing'); + sequencer.addSteps('green-channel'); t.equal(sequencer.images.test.steps.length, 3, "Length of steps increased"); - t.equal(sequencer.images.test.steps[2].options.name, "do-nothing", "Correct Step Added"); + t.equal(sequencer.images.test.steps[2].options.name, "green-channel", "Correct Step Added"); t.end(); }); test('addSteps(["name"]) adds a step', function (t) { - sequencer.addSteps(['do-nothing','do-nothing-pix']); + sequencer.addSteps(['green-channel','invert']); t.equal(sequencer.images.test.steps.length, 5, "Length of steps increased by two") - t.equal(sequencer.images.test.steps[3].options.name, "do-nothing", "Correct Step Added"); - t.equal(sequencer.images.test.steps[4].options.name, "do-nothing-pix", "Correct Step Added"); + t.equal(sequencer.images.test.steps[3].options.name, "green-channel", "Correct Step Added"); + t.equal(sequencer.images.test.steps[4].options.name, "invert", "Correct Step Added"); t.end(); }); test('addSteps("name",o) adds a step', function (t) { - sequencer.addSteps('do-nothing',{}); + sequencer.addSteps('green-channel',{}); t.equal(sequencer.images.test.steps.length, 6, "Length of steps increased"); - t.equal(sequencer.images.test.steps[5].options.name, "do-nothing", "Correct Step Added"); + t.equal(sequencer.images.test.steps[5].options.name, "green-channel", "Correct Step Added"); t.end(); }); test('addSteps("image","name",o) adds a step', function (t) { - sequencer.addSteps('test','do-nothing',{}); + sequencer.addSteps('test','green-channel',{}); t.equal(sequencer.images.test.steps.length, 7, "Length of steps increased"); - t.equal(sequencer.images.test.steps[6].options.name, "do-nothing", "Correct Step Added"); + t.equal(sequencer.images.test.steps[6].options.name, "green-channel", "Correct Step Added"); t.end(); }); @@ -127,30 +127,30 @@ test('removeSteps(position) removes steps', function (t) { }); test('insertSteps("image",position,"module",options) inserts a step', function (t) { - sequencer.insertSteps('test',1,'do-nothing',{}); + sequencer.insertSteps('test',1,'green-channel',{}); t.equal(sequencer.images.test.steps.length, 3, "Length of Steps increased"); - t.equal(sequencer.images.test.steps[1].options.name, "do-nothing", "Correct Step Inserted"); + t.equal(sequencer.images.test.steps[1].options.name, "green-channel", "Correct Step Inserted"); t.end(); }); test('insertSteps("image",position,"module") inserts a step', function (t) { - sequencer.insertSteps('test',1,'do-nothing'); + sequencer.insertSteps('test',1,'green-channel'); t.equal(sequencer.images.test.steps.length, 4, "Length of Steps increased"); - t.equal(sequencer.images.test.steps[1].options.name, "do-nothing", "Correct Step Inserted"); + t.equal(sequencer.images.test.steps[1].options.name, "green-channel", "Correct Step Inserted"); t.end(); }); test('insertSteps(position,"module") inserts a step', function (t) { - sequencer.insertSteps(1,'do-nothing'); + sequencer.insertSteps(1,'green-channel'); t.equal(sequencer.images.test.steps.length, 5, "Length of Steps increased"); - t.equal(sequencer.images.test.steps[1].options.name, "do-nothing", "Correct Step Inserted"); + t.equal(sequencer.images.test.steps[1].options.name, "green-channel", "Correct Step Inserted"); 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:{} } }); + sequencer.insertSteps({test: {index:1, name:'green-channel', o:{} } }); t.equal(sequencer.images.test.steps.length, 6, "Length of Steps increased"); - t.equal(sequencer.images.test.steps[1].options.name, "do-nothing", "Correct Step Inserted"); + t.equal(sequencer.images.test.steps[1].options.name, "green-channel", "Correct Step Inserted"); t.end(); });