Module tests (#1058)

* change all old module benchmarks

* no node 6

* add average module tests

* edge-detect test added

* edge detect tests

* flip-image tests

* tint tests

* saturation tests

* gradient tests

* exposure tests

* draw-rectangle tests

* color-temperature tests

* convolution tests

* paint-bucket tests

* ndvi tests

* ndvi-colormap tests

* histogram tests

* crop tests

* gamma-correction tests

* dynamic tests

* colorbar tests

* webgl-distort tests

* fisheye-gl tests

* blend module tests

* overlay module tests
This commit is contained in:
Harsh Khandeparkar
2019-05-07 01:11:42 +05:30
committed by Jeffrey Warren
parent 06ac596d7e
commit 0c3d7be7e2
54 changed files with 398 additions and 637 deletions

View File

@@ -0,0 +1,29 @@
'use strict';
var fs = require('fs');
var test = require('tape');
var DataURItoBuffer = require('data-uri-to-buffer');
require('../../../src/ImageSequencer.js');
var sequencer = ImageSequencer({ ui: false });
var red = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z";
sequencer.loadImages(red);
sequencer.addSteps('invert');
sequencer.addSteps('invert');
sequencer.addSteps('invert');
test('run() works with all possible argument combinations',function(t){
sequencer.run(function (out) {
var output1 = DataURItoBuffer(sequencer.steps.slice(-1)[0].output.src);
sequencer.steps.splice(1,1);
sequencer.run({index: 1},function(out){
var output2 = DataURItoBuffer(sequencer.steps.slice(-1)[0].output.src);
t.deepEqual(output1,output2,"output remains same after removing a step and running sequencer from a greater index");
sequencer.run(function(out){
t.end();
})
});
});
});