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.inBrowser = options.inBrowser || typeof window !== 'undefined';
|
||||
options.ui = options.ui || require('./UserInterface');
|
||||
if (options.inBrowser) options.ui = options.ui || require('./UserInterface');
|
||||
|
||||
var image,
|
||||
steps = [],
|
||||
@@ -34,7 +34,7 @@ ImageSequencer = function ImageSequencer(options) {
|
||||
else {
|
||||
setup.apply(module); // run default setup() in scope of module (is this right?)
|
||||
function setup() {
|
||||
module.options.ui = options.ui({
|
||||
if (module.options.ui) module.options.ui = options.ui({
|
||||
selector: o.selector
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ module.exports = {
|
||||
'image-select': require('./modules/ImageSelect'),
|
||||
'green-channel': require('./modules/GreenChannel'),
|
||||
'ndvi-red': require('./modules/NdviRed'),
|
||||
'plot': require('./modules/Plot'),
|
||||
// 'plot': require('./modules/Plot'),
|
||||
'image-threshold': require('./modules/ImageThreshold')
|
||||
|
||||
}
|
||||
|
||||
@@ -8,22 +8,15 @@ var test = require('tape');
|
||||
|
||||
require('../dist/image-sequencer.js');
|
||||
|
||||
var sequencer = ImageSequencer({
|
||||
defaultSteps: function() {
|
||||
console.log('defaults');
|
||||
},
|
||||
ui: {
|
||||
create: function() {}
|
||||
}
|
||||
});
|
||||
var sequencer = ImageSequencer({ ui: false });
|
||||
|
||||
function read (file) {
|
||||
return fs.readFileSync('./test/fixtures/' + file, 'utf8').trim();
|
||||
}
|
||||
//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');
|
||||
}
|
||||
//function write (file, data) { /* jshint ignore:line */
|
||||
// return fs.writeFileSync('./test/fixtures/' + file, data + '\n', 'utf8');
|
||||
//}
|
||||
|
||||
test('Image Sequencer has tests', function (t) {
|
||||
// read('something.html')
|
||||
@@ -38,10 +31,26 @@ test('addStep adds a step', function (t) {
|
||||
t.end();
|
||||
});
|
||||
|
||||
//test('test each module', function (t) {
|
||||
// steps.forEach(function(step, i) {
|
||||
test('each module conforms to base API except image-select', function (t) {
|
||||
Object.keys(sequencer.modules).forEach(function(moduleName, i) {
|
||||
if (moduleName != "image-select") sequencer.addStep(moduleName);
|
||||
});
|
||||
// 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
|
||||
// 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