Permalink
Browse files

Setup integration snapshot test

  • Loading branch information...
hanneskaeufler committed Feb 10, 2018
1 parent dbce7e6 commit bb59d45fd0f06b28f09e2cfa56e23f89e64176c4
Showing with 63 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +16 −0 integration_tests.js
  3. +7 −0 integration_tests.py
  4. +23 −0 package-lock.json
  5. +14 −0 package.json
@@ -1 +1,4 @@
*.pyc
actual.png
diff.png
/node_modules/
@@ -0,0 +1,16 @@
var fs = require('fs'),
PNG = require('pngjs').PNG,
pixelmatch = require('pixelmatch');

var img1 = fs.createReadStream('expected.png').pipe(new PNG()).on('parsed', doneReading),
img2 = fs.createReadStream('actual.png').pipe(new PNG()).on('parsed', doneReading),
filesRead = 0;

function doneReading() {
if (++filesRead < 2) return;
var diff = new PNG({width: img1.width, height: img1.height});

pixelmatch(img1.data, img2.data, diff.data, img1.width, img1.height, {threshold: 0.1});

diff.pack().pipe(fs.createWriteStream('diff.png'));
}
@@ -0,0 +1,7 @@
import dash

def main():
dash.Dash().render().save('actual.png')

if __name__ == '__main__':
main()

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,14 @@
{
"name": "e-ink-dash",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "python dash_tests.py && python integration_tests.py && node integration_tests.js && open diff.png"
},
"author": "",
"license": "ISC",
"devDependencies": {
"pixelmatch": "^4.0.2"
}
}

0 comments on commit bb59d45

Please sign in to comment.