mirror of
https://github.com/publiclab/image-sequencer.git
synced 2026-06-16 04:33:26 +02:00
Image Diff based testing
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
"devDependencies": {
|
||||
"browserify": "13.0.0",
|
||||
"buffer": "~5.0.2",
|
||||
"data-uri-to-buffer": "^2.0.0",
|
||||
"get-pixels": "~3.3.0",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-browserify": "^5.0.0",
|
||||
@@ -38,6 +39,7 @@
|
||||
"image-filter-core": "~1.0.0",
|
||||
"image-filter-threshold": "~1.0.0",
|
||||
"imagemagick": "^0.1.3",
|
||||
"looks-same": "^3.2.1",
|
||||
"matchdep": "^0.3.0",
|
||||
"plotly.js": "~1.21.2",
|
||||
"save-pixels": "~2.3.4",
|
||||
|
||||
+20
-4
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var looksSame = require('looks-same');
|
||||
var DataURItoBuffer = require('data-uri-to-buffer');
|
||||
|
||||
// We should only test headless code here.
|
||||
// http://stackoverflow.com/questions/21358015/error-jquery-requires-a-window-with-a-document#25622933
|
||||
@@ -23,13 +25,27 @@ test("Preload", function(t) {
|
||||
});
|
||||
|
||||
test("Inverted image isn't identical", function (t) {
|
||||
t.notEqual(sequencer.images.image1.steps[1].output.src, sequencer.images.image1.steps[2].output.src);
|
||||
t.end();
|
||||
var step1 = sequencer.images.image1.steps[1].output.src;
|
||||
var step2 = sequencer.images.image1.steps[2].output.src;
|
||||
step1 = DataURItoBuffer(step1);
|
||||
step2 = DataURItoBuffer(step2);
|
||||
looksSame(step1,step2,function(err,res){
|
||||
if(err) console.log(err);
|
||||
t.equal(res,false);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
test("Twice inverted image is identical to original image", function (t) {
|
||||
t.equal(sequencer.images.image1.steps[1].output.src, sequencer.images.image1.steps[3].output.src);
|
||||
t.end();
|
||||
var step1 = sequencer.images.image1.steps[1].output.src;
|
||||
var step3 = sequencer.images.image1.steps[3].output.src;
|
||||
step1 = DataURItoBuffer(step1);
|
||||
step3 = DataURItoBuffer(step3);
|
||||
looksSame(step1,step3,function(err,res){
|
||||
if(err) console.log(err);
|
||||
t.equal(res,true);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
test("PixelManipulation works for PNG images", function (t) {
|
||||
|
||||
Reference in New Issue
Block a user