Keep custom test logic in one place

This commit is contained in:
Tim Schaub
2015-04-13 08:45:27 -06:00
parent 129ed0a6c5
commit 401ab6e829
2 changed files with 8 additions and 14 deletions

View File

@@ -3,6 +3,12 @@
// helper functions for async testing and other utility functions.
(function(global) {
// show generated maps for rendering tests
var showMap = (global.location.search.indexOf('generate') >= 0);
// show a diff when rendering tests fail
var showDiff = (global.location.search.indexOf('showdiff') >= 0);
/**
* The default tolerance for image comparisons.
*/
@@ -358,7 +364,7 @@
};
function resembleCanvas(canvas, referenceImage, tolerance, done) {
if (window.showMap) {
if (showMap) {
document.body.appendChild(canvas);
}
@@ -373,7 +379,7 @@
}
if (data.misMatchPercentage > tolerance) {
if (window.showDiff) {
if (showDiff) {
var diffImage = new Image();
diffImage.src = data.getImageDataUrl();
document.body.appendChild(diffImage);