-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbce7e6
commit bb59d45
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
*.pyc | ||
actual.png | ||
diff.png | ||
/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |