mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-11 19:00:00 +01:00
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:
committed by
Jeffrey Warren
parent
06ac596d7e
commit
0c3d7be7e2
33
test/core/testModule/Module.js
Normal file
33
test/core/testModule/Module.js
Normal file
@@ -0,0 +1,33 @@
|
||||
module.exports = function Dynamic(options, UI, util) {
|
||||
// Tests for functions that are available inside modules only
|
||||
|
||||
var output;
|
||||
|
||||
// This function is called on every draw.
|
||||
function draw(input, callback) {
|
||||
|
||||
var step = this;
|
||||
|
||||
if (this.getPreviousStep().options.name != "invert") throw new Error("getPreviousStep not working");
|
||||
if (this.getNextStep().options.name != "invert") throw new Error("getNextStep not working");
|
||||
if (this.getInput(0) != this.getOutput(-1)) throw new Error("getInput and getOuput now working")
|
||||
if (this.getFormat() != "jpeg") throw new Error("getFormat not working");
|
||||
if (this.getOptions().name != "test") throw new Error("getOptions not working");
|
||||
this.setOptions({ name: "test-1" });
|
||||
if (this.getOptions().name != "test-1") throw new Error("setOptions not working not working");
|
||||
this.getHeight(((h) => { if (h != 16) throw new Error("getHeight not working") }));
|
||||
this.getWidth((w) => { if (w != 16) throw new Error("getWidth not working") });
|
||||
|
||||
function output(image, datauri, mimetype) {
|
||||
step.output = input;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
options: options,
|
||||
draw: draw,
|
||||
output: output,
|
||||
UI: UI
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user