Bug 852850 - Follow-up to improve failure output with reftest-no-paint. r=dbaron

This commit is contained in:
Matt Woodrow 2013-06-07 17:10:31 +12:00
parent 4a4ec454fe
commit c0cd112167
5 changed files with 76 additions and 25 deletions

View File

@ -0,0 +1,7 @@
<!DOCTYPE HTML>
<html>
<body style="background-color: black">
<div style="background-color: rgba(255, 0, 0, 0.5); width:100px; height:100px;" >
</div>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<body>
<div class="reftest-no-paint" style="background-color: rgba(255, 0, 0, 0.5); width:100px; height:100px;" >
</div>
<script type="application/javascript">
function doTest() {
document.body.style.background = "black";
document.documentElement.removeAttribute("class");
}
document.addEventListener("MozReftestInvalidate", doTest, false);
</script>
</body>
</html>

View File

@ -155,3 +155,6 @@ fuzzy-if(true,1,250000) == fuzzy.html fuzzy-ref.html
fuzzy-if(false,2,1) == fuzzy-ref.html fuzzy-ref.html
# When using 565 fuzzy.html and fuzzy-ref.html will compare as equal
fails fuzzy-if(false,2,1) random-if(Android) == fuzzy.html fuzzy-ref.html
# Test that reftest-no-paint fails correctly
fails == reftest-no-paint.html reftest-no-paint-ref.html

View File

@ -444,7 +444,7 @@ function WaitForTestEnd(contentRootElement, inPrintMode, spellCheckedElements) {
var elements = getNoPaintElements(contentRootElement);
for (var i = 0; i < elements.length; ++i) {
if (windowUtils().checkAndClearPaintedState(elements[i])) {
LogError("REFTEST TEST-UNEXPECTED-FAIL | element marked as reftest-no-paint got repainted!");
SendFailedNoPaint();
}
}
}
@ -784,6 +784,11 @@ function SendFailedLoad(why)
sendAsyncMessage("reftest:FailedLoad", { why: why });
}
function SendFailedNoPaint()
{
sendAsyncMessage("reftest:FailedNoPaint");
}
function SendEnableAsyncScroll()
{
sendAsyncMessage("reftest:EnableAsyncScroll");

View File

@ -103,6 +103,7 @@ var gExpectingProcessCrash = false;
var gExpectedCrashDumpFiles = [];
var gUnexpectedCrashDumpFiles = { };
var gCrashDumpDir;
var gFailedNoPaint = false;
const TYPE_REFTEST_EQUAL = '==';
const TYPE_REFTEST_NOTEQUAL = '!=';
@ -1551,39 +1552,49 @@ function RecordResult(testRunTime, errorMsg, scriptResults)
}
// whether the comparison result matches what is in the manifest
var test_passed = (equal == (gURLs[0].type == TYPE_REFTEST_EQUAL));
var test_passed = (equal == (gURLs[0].type == TYPE_REFTEST_EQUAL)) && !gFailedNoPaint;
output = outputs[expected][test_passed];
++gTestResults[output.n];
var result = "REFTEST " + output.s + " | " +
gURLs[0].prettyPath + " | "; // the URL being tested
switch (gURLs[0].type) {
case TYPE_REFTEST_NOTEQUAL:
result += "image comparison (!=)";
break;
case TYPE_REFTEST_EQUAL:
result += "image comparison (==)";
break;
}
if (!test_passed && expected == EXPECTED_PASS ||
!test_passed && expected == EXPECTED_FUZZY ||
test_passed && expected == EXPECTED_FAIL) {
if (!equal) {
result += ", max difference: " + maxDifference.value + ", number of differing pixels: " + differences + "\n";
result += "REFTEST IMAGE 1 (TEST): " + gCanvas1.toDataURL() + "\n";
result += "REFTEST IMAGE 2 (REFERENCE): " + gCanvas2.toDataURL() + "\n";
// It's possible that we failed both reftest-no-paint and the normal comparison, but we don't
// have a way to annotate these separately, so just print an error for the no-paint failure.
if (gFailedNoPaint) {
if (expected == EXPECTED_FAIL) {
gDumpLog("REFTEST TEST-KNOWN-FAIL | " + gURLs[0].prettyPath + " | failed reftest-no-paint\n");
} else {
result += "\n";
gDumpLog("REFTEST IMAGE: " + gCanvas1.toDataURL() + "\n");
gDumpLog("REFTEST TEST-UNEXPECTED-FAIL | " + gURLs[0].prettyPath + " | failed reftest-no-paint\n");
}
} else {
result += "\n";
}
var result = "REFTEST " + output.s + " | " +
gURLs[0].prettyPath + " | "; // the URL being tested
switch (gURLs[0].type) {
case TYPE_REFTEST_NOTEQUAL:
result += "image comparison (!=)";
break;
case TYPE_REFTEST_EQUAL:
result += "image comparison (==)";
break;
}
gDumpLog(result);
if (!test_passed && expected == EXPECTED_PASS ||
!test_passed && expected == EXPECTED_FUZZY ||
test_passed && expected == EXPECTED_FAIL) {
if (!equal) {
result += ", max difference: " + maxDifference.value + ", number of differing pixels: " + differences + "\n";
result += "REFTEST IMAGE 1 (TEST): " + gCanvas1.toDataURL() + "\n";
result += "REFTEST IMAGE 2 (REFERENCE): " + gCanvas2.toDataURL() + "\n";
} else {
result += "\n";
gDumpLog("REFTEST IMAGE: " + gCanvas1.toDataURL() + "\n");
}
} else {
result += "\n";
}
gDumpLog(result);
}
if (!test_passed && expected == EXPECTED_PASS) {
FlushTestLog();
@ -1672,6 +1683,7 @@ function FinishTestItem()
// and tests will continue.
SetAsyncScroll(false);
SendClear();
gFailedNoPaint = false;
}
function DoAssertionCheck(numAsserts)
@ -1767,6 +1779,10 @@ function RegisterMessageListenersAndLoadContentScript()
"reftest:FailedLoad",
function (m) { RecvFailedLoad(m.json.why); }
);
gBrowserMessageManager.addMessageListener(
"reftest:FailedNoPaint",
function (m) { RecvFailedNoPaint(); }
);
gBrowserMessageManager.addMessageListener(
"reftest:InitCanvasWithSnapshot",
function (m) { return RecvInitCanvasWithSnapshot(); }
@ -1828,6 +1844,11 @@ function RecvFailedLoad(why)
LoadFailed(why);
}
function RecvFailedNoPaint()
{
gFailedNoPaint = true;
}
function RecvInitCanvasWithSnapshot()
{
var painted = InitCurrentCanvasWithSnapshot();