Skip to content

Commit

Permalink
feat: if image diffs occur write out the diff image
Browse files Browse the repository at this point in the history
  • Loading branch information
blacha committed Oct 6, 2019
1 parent ec1caf7 commit d4307c2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/tiler/src/__test__/tile.creation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ describe('TileCreation', () => {
const expectedImage = await getExpectedTile(tileSize, centerTile, centerTile, zoom);

const missMatchedPixels = PixelMatch(expectedImage.data, newImage.data, null, tileSize, tileSize);
if (missMatchedPixels > 0) {
const fileName = getExpectedTileName(tileSize, centerTile, centerTile, zoom) + '.diff.png';
const output = new PNG({ width: tileSize, height: tileSize });
PixelMatch(expectedImage.data, newImage.data, output.data, tileSize, tileSize);
writeFileSync(fileName, PNG.sync.write(output));
}
expect(missMatchedPixels).toEqual(0);
});
});
Expand Down

0 comments on commit d4307c2

Please sign in to comment.