Bug 1342252 - Fix printing of reftest images for failed != tests. r=jgraham

This makes the code work the way it looks like it was intended to work
based on what was already in output.py.

MozReview-Commit-ID: 8LJHxlfiQQ8

--HG--
extra : rebase_source : 46b2435ddbd3e8485536806d9fc7987599227f16
This commit is contained in:
L. David Baron 2017-02-23 14:34:27 -08:00
parent 516e1c0ce2
commit e7546e008c
2 changed files with 8 additions and 3 deletions

View File

@ -52,14 +52,14 @@ class ReftestFormatter(TbplFormatter):
if "reftest_screenshots" in extra:
screenshots = extra["reftest_screenshots"]
image_1 = screenshots[0]["screenshot"]
image_2 = screenshots[2]["screenshot"]
if len(screenshots) == 3:
image_2 = screenshots[2]["screenshot"]
output_text += ("\nREFTEST IMAGE 1 (TEST): data:image/png;base64,%s\n"
"REFTEST IMAGE 2 (REFERENCE): data:image/png;base64,%s") % (
image_1, image_2)
elif len(screenshots) == 1:
output_text += "\nREFTEST IMAGE: data:image/png;base64,%(image1)s" % image_1
output_text += "\nREFTEST IMAGE: data:image/png;base64,%s" % image_1
output_text += "\nREFTEST TEST-END | %s" % test
return "%s\n" % output_text

View File

@ -1762,7 +1762,12 @@ function RecordResult(testRunTime, errorMsg, scriptResults)
message += (", max difference: " + extra.max_difference +
", number of differing pixels: " + differences);
} else {
extra.image1 = gCanvas1.toDataURL();
var image1 = gCanvas1.toDataURL();
extra.reftest_screenshots = [
{url:gURLs[0].identifier[0],
screenshot: image1.slice(image1.indexOf(",") + 1)}
];
extra.image1 = image1;
}
}
logger.testEnd(gURLs[0].identifier, output.s[0], output.s[1], message, null, extra);