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

@@ -1,41 +1,4 @@
var test = require('tape');
var base64Img = require('base64-img');
var looksSame = require('looks-same');
const testModule = require('../templates/module-test'),
benchmark = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAklEQVR4AewaftIAAAApSURBVKXBAQEAAAiAIPP/5+qDMPsIJJJIIokkkkgiiSSSSCKJJJJIogNrygQcXEYsHQAAAABJRU5ErkJggg==";
require('../../../src/ImageSequencer.js');
var sequencer = ImageSequencer({ ui: false });
var options = {threshold: "Automatic Thresholding"};
var target = 'test_outputs';
var red = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX+AAD///+KQee0AAAAAWJLR0QB/wIt3gAAAAd0SU1FB+EGHRIVAvrm6EMAAAAMSURBVAjXY2AgDQAAADAAAceqhY4AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDYtMjlUMTg6MjE6MDIrMDI6MDDGD83DAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTA2LTI5VDE4OjIxOjAyKzAyOjAwt1J1fwAAAABJRU5ErkJggg==";
var benchmark = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAklEQVR4AewaftIAAAApSURBVKXBAQEAAAiAIPP/5+qDMPsIJJJIIokkkkgiiSSSSCKJJJJIogNrygQcXEYsHQAAAABJRU5ErkJggg==";
// Test 1 to check threshold module is getting loaded
test('Load Threshold module', function(t) {
sequencer.loadImages(red);
sequencer.addSteps('threshold', options);
t.equal(sequencer.steps[1].options.name, 'threshold', 'Threshold module is getting loaded');
t.end();
});
// Test 2 to check options are correct
test('Check Options', function(t) {
t.equal(sequencer.steps[1].options.threshold, "Automatic Thresholding", 'Options are correct');
t.end();
});
// Test 3 to check threshold module works as expected
test('Threshold module works correctly', function(t) {
sequencer.run({ mode: 'test' }, function(out) {
var result = sequencer.steps[1].output.src
base64Img.imgSync(result, target, 'result')
base64Img.imgSync(benchmark, target, 'benchmark')
result = './test_outputs/result.png'
benchmark = './test_outputs/benchmark.png'
looksSame(result, benchmark, function(err, res) {
if (err) console.log(err)
t.equal(res.equal, true)
t.end()
})
})
})
testModule('threshold', {threshold: 'Automatic Thresholding'}, benchmark)