mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-13 11:50:02 +01:00
More Complete Tests
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user