mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-13 20:00:05 +01:00
tests passing again
This commit is contained in:
149797
dist/image-sequencer.js
vendored
149797
dist/image-sequencer.js
vendored
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@ ImageSequencer = function ImageSequencer(options) {
|
|||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
options.inBrowser = options.inBrowser || typeof window !== 'undefined';
|
options.inBrowser = options.inBrowser || typeof window !== 'undefined';
|
||||||
options.ui = options.ui || require('./UserInterface');
|
if (options.inBrowser) options.ui = options.ui || require('./UserInterface');
|
||||||
|
|
||||||
var image,
|
var image,
|
||||||
steps = [],
|
steps = [],
|
||||||
@@ -34,7 +34,7 @@ ImageSequencer = function ImageSequencer(options) {
|
|||||||
else {
|
else {
|
||||||
setup.apply(module); // run default setup() in scope of module (is this right?)
|
setup.apply(module); // run default setup() in scope of module (is this right?)
|
||||||
function setup() {
|
function setup() {
|
||||||
module.options.ui = options.ui({
|
if (module.options.ui) module.options.ui = options.ui({
|
||||||
selector: o.selector
|
selector: o.selector
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ module.exports = {
|
|||||||
'image-select': require('./modules/ImageSelect'),
|
'image-select': require('./modules/ImageSelect'),
|
||||||
'green-channel': require('./modules/GreenChannel'),
|
'green-channel': require('./modules/GreenChannel'),
|
||||||
'ndvi-red': require('./modules/NdviRed'),
|
'ndvi-red': require('./modules/NdviRed'),
|
||||||
'plot': require('./modules/Plot'),
|
// 'plot': require('./modules/Plot'),
|
||||||
'image-threshold': require('./modules/ImageThreshold')
|
'image-threshold': require('./modules/ImageThreshold')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,22 +8,15 @@ var test = require('tape');
|
|||||||
|
|
||||||
require('../dist/image-sequencer.js');
|
require('../dist/image-sequencer.js');
|
||||||
|
|
||||||
var sequencer = ImageSequencer({
|
var sequencer = ImageSequencer({ ui: false });
|
||||||
defaultSteps: function() {
|
|
||||||
console.log('defaults');
|
|
||||||
},
|
|
||||||
ui: {
|
|
||||||
create: function() {}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function read (file) {
|
//function read (file) {
|
||||||
return fs.readFileSync('./test/fixtures/' + file, 'utf8').trim();
|
// return fs.readFileSync('./test/fixtures/' + file, 'utf8').trim();
|
||||||
}
|
//}
|
||||||
|
|
||||||
function write (file, data) { /* jshint ignore:line */
|
//function write (file, data) { /* jshint ignore:line */
|
||||||
return fs.writeFileSync('./test/fixtures/' + file, data + '\n', 'utf8');
|
// return fs.writeFileSync('./test/fixtures/' + file, data + '\n', 'utf8');
|
||||||
}
|
//}
|
||||||
|
|
||||||
test('Image Sequencer has tests', function (t) {
|
test('Image Sequencer has tests', function (t) {
|
||||||
// read('something.html')
|
// read('something.html')
|
||||||
@@ -38,10 +31,26 @@ test('addStep adds a step', function (t) {
|
|||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
//test('test each module', function (t) {
|
test('each module conforms to base API except image-select', function (t) {
|
||||||
// steps.forEach(function(step, i) {
|
Object.keys(sequencer.modules).forEach(function(moduleName, i) {
|
||||||
// t.equal(step.test(step.testInput),step.testOutput);
|
if (moduleName != "image-select") sequencer.addStep(moduleName);
|
||||||
// // or check that it's equal with a diff method?
|
});
|
||||||
// // we could also test each type of output
|
// should already have image-select:
|
||||||
// });
|
t.equal(sequencer.steps.length, Object.keys(sequencer.modules).length);
|
||||||
|
sequencer.steps.forEach(function(step, i) {
|
||||||
|
//t.equal(step.test(step.testInput),step.testOutput);
|
||||||
|
// or check that it's equal with a diff method?
|
||||||
|
// we could also test each type of output
|
||||||
|
t.equal(step.setup === 'undefined', false);
|
||||||
|
t.equal(step.draw === 'undefined', false);
|
||||||
|
});
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
//test('a blank module does not modify an image, according to diff', function (t) {
|
||||||
|
|
||||||
|
//});
|
||||||
|
|
||||||
|
//test('a module modifies an image', function (t) {
|
||||||
|
|
||||||
//});
|
//});
|
||||||
|
|||||||
Reference in New Issue
Block a user