forked from visgl/deck.gl
-
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.
Refactor render tests; use stricter pass criteria (visgl#4157)
- Loading branch information
1 parent
60b8edb
commit bca2822
Showing
61 changed files
with
2,310 additions
and
2,654 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
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
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
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
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
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,38 @@ | ||
/* | ||
Script to retrieve failed screenshot from CI | ||
- In render test, enable `saveOnFail` | ||
- node scripts/print-golden-image.js <image_name> <sx> <sy> <width> <height> | ||
- Copy the printed base64 string | ||
- Use `restore` function in this file to convert string back to image | ||
*/ | ||
const {PNG} = require('pngjs'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const INPUT_FILE = path.resolve('./test/render/golden-images', process.argv[2]); | ||
const OUTPUT_FILE = 'out.png'; | ||
|
||
const SOURCE_X = Number(process.argv[3]) || 0; | ||
const SOURCE_Y = Number(process.argv[4]) || 0; | ||
const WIDTH = Number(process.argv[5]) || 800; | ||
const HEIGHT = Number(process.argv[6]) || 450; | ||
|
||
fs.createReadStream(INPUT_FILE) | ||
.pipe(new PNG()) | ||
.on('parsed', function() { | ||
const dst = new PNG({width: WIDTH, height: HEIGHT}); | ||
// copy to destination | ||
this.bitblt(dst, SOURCE_X, SOURCE_Y, WIDTH, HEIGHT, 0, 0); | ||
|
||
dst.pack().pipe(fs.createWriteStream('out.png')) | ||
.on('close', function() { | ||
const buffer = fs.readFileSync('out.png'); | ||
console.log(buffer.toString('base64')); | ||
}); | ||
}); | ||
|
||
// Call to convert base64 back to file | ||
function restore(base64, width, height) { | ||
const buffer = Buffer.from(base64, 'base64'); | ||
fs.writeFileSync('out.png', buffer); | ||
} |
File renamed without changes
File renamed without changes
File renamed without changes
Oops, something went wrong.