Backed out changeset 5bf3661db065 (Bug 454349) due to Windows reftest failures.

This commit is contained in:
L. David Baron 2008-12-16 18:15:38 -08:00
parent af4589e214
commit db94b8d7d7
2 changed files with 45 additions and 82 deletions

View File

@ -42,10 +42,10 @@ fails == 25888-2l.html 25888-2l-ref.html # bug 25888
fails == 25888-2r.html 25888-2r-ref.html # bug 25888
fails == 25888-3l.html 25888-3l-ref.html # bug 25888
fails == 25888-3r.html 25888-3r-ref.html # bug 25888
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 28811-1a.html 28811-1-ref.html # bug 468496
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 28811-1b.html 28811-1-ref.html # bug 468496
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 28811-2a.html 28811-2-ref.html # bug 468496
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 28811-2b.html 28811-2-ref.html # bug 468496
== 28811-1a.html 28811-1-ref.html
== 28811-1b.html 28811-1-ref.html
== 28811-2a.html 28811-2-ref.html
== 28811-2b.html 28811-2-ref.html
== 40596-1a.html 40596-1-ref.html
!= 40596-1b.html 40596-1-ref.html
== 40596-1c.html 40596-1-ref.html
@ -115,10 +115,10 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 28811-2b.html 28811-2-ref.html # bug 46
== 144004-1.html 144004-1-ref.html
== 144004-2.html 144004-2-ref.html
!= 144004-3.html 144004-3-ref.html
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 163504-1a.html 163504-1-ref.html # bug 468496
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 163504-1b.html 163504-1-ref.html # bug 468496
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 163504-2a.html 163504-2-ref.html # bug 468496
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 163504-2b.html 163504-2-ref.html # bug 468496
== 163504-1a.html 163504-1-ref.html
== 163504-1b.html 163504-1-ref.html
== 163504-2a.html 163504-2-ref.html
== 163504-2b.html 163504-2-ref.html
== 169749-1.html 169749-1-ref.html
== 172073-1.html 172073-1-ref.html
== 180085-1.html 180085-1-ref.html

View File

@ -56,7 +56,7 @@ const NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX =
const LOAD_FAILURE_TIMEOUT = 10000; // ms
var gBrowser;
var gCanvasTest, gCanvasRef;
var gCanvas1, gCanvas2;
var gURLs;
// Map from URI spec to the number of times it remains to be used
var gURIUseCounts;
@ -284,8 +284,8 @@ function ReadManifest(aURL)
gURLs.push( { equal: true /* meaningless */,
expected: expected_status,
prettyPath: prettyPath,
urltest: testURI,
urlref: null } );
url1: testURI,
url2: null } );
} else if (items[0] == "==" || items[0] == "!=") {
if (items.length != 3)
throw "Error in manifest file " + aURL.spec + " line " + lineNo;
@ -304,20 +304,20 @@ function ReadManifest(aURL)
gURLs.push( { equal: (items[0] == "=="),
expected: expected_status,
prettyPath: prettyPath,
urltest: testURI,
urlref: refURI } );
url1: testURI,
url2: refURI } );
} else {
throw "Error in manifest file " + aURL.spec + " line " + lineNo;
}
} while (more);
}
function AddURIUseCount(which, uri)
function AddURIUseCount(uri)
{
if (uri == null)
return;
var spec = which + "-" + uri.spec;
var spec = uri.spec;
if (spec in gURIUseCounts) {
gURIUseCounts[spec]++;
} else {
@ -331,8 +331,8 @@ function BuildUseCounts()
for (var i = 0; i < gURLs.length; ++i) {
var expected = gURLs[i].expected;
if (expected != EXPECTED_DEATH && expected != EXPECTED_LOAD) {
AddURIUseCount("test", gURLs[i].urltest);
AddURIUseCount("ref", gURLs[i].urlref);
AddURIUseCount(gURLs[i].url1);
AddURIUseCount(gURLs[i].url2);
}
}
}
@ -384,7 +384,7 @@ function StartCurrentTest()
// make sure we don't run tests that are expected to kill the browser
while (gURLs.length > 0 && gURLs[0].expected == EXPECTED_DEATH) {
++gTestResults.Skip;
dump("REFTEST TEST-KNOWN-FAIL | " + gURLs[0].urltest.spec + " | (SKIP)\n");
dump("REFTEST TEST-KNOWN-FAIL | " + gURLs[0].url1.spec + " | (SKIP)\n");
gURLs.shift();
}
@ -395,7 +395,7 @@ function StartCurrentTest()
var currentTest = gTotalTests - gURLs.length;
document.title = "reftest: " + currentTest + " / " + gTotalTests +
" (" + Math.floor(100 * (currentTest / gTotalTests)) + "%)";
StartCurrentURI("test");
StartCurrentURI(1);
}
}
@ -408,8 +408,7 @@ function StartCurrentURI(aState)
gState = aState;
gCurrentURL = gURLs[0]["url" + aState].spec;
if (gURICanvases[aState + "-" + gCurrentURL] &&
gURLs[0].expected != EXPECTED_LOAD) {
if (gURICanvases[gCurrentURL] && gURLs[0].expected != EXPECTED_LOAD) {
// Pretend the document loaded --- DocumentLoaded will notice
// there's already a canvas for this URL
setTimeout(DocumentLoaded, 0);
@ -539,9 +538,9 @@ function OnDocumentLoad(event)
}
}
function UpdateCanvasCache(which, url, canvas)
function UpdateCanvasCache(url, canvas)
{
var spec = which + "-" + url.spec;
var spec = url.spec;
--gURIUseCounts[spec];
if (gURIUseCounts[spec] == 0) {
@ -574,82 +573,46 @@ function DocumentLoaded()
return;
}
// To catch cases where page rendering doesn't paint opaque color
// over the entire viewport (e.g. bug 453566), we avoid having
// drawWindow erase the requested rectangle before rendering.
// Instead, we manually erase the canvas to white, then fill the
// bounding box reported by the document's root with different
// colors for test and reference.
//
// We can't just fill the canvas with different colors for the
// test and reference, because the viewport can be smaller than
// the rectangle requested in the drawWindow call; the bounding
// box reported by the document root is the closest approximation
// to the viewport rectangle that's available in the DOM.
var canvas;
var bgcolor;
var cachespec = gState + "-" + gCurrentURL;
if (gURICanvases[cachespec]) {
canvas = gURICanvases[cachespec];
if (gURICanvases[gCurrentURL]) {
canvas = gURICanvases[gCurrentURL];
} else {
canvas = AllocateCanvas();
if (gState == "test") {
bgcolor = "rgb(255,0,123)";
} else {
bgcolor = "rgb(255,74,0)";
}
/* XXX This needs to be rgb(255,255,255) because otherwise we get
* black bars at the bottom of every test that are different size
* for the first test and the rest (scrollbar-related??) */
var win = gBrowser.contentWindow;
var ctx = canvas.getContext("2d");
var bbox = gBrowser.contentDocument.documentElement.getBoundingClientRect();
var scale = gBrowser.markupDocumentViewer.fullZoom;
ctx.save();
ctx.fillStyle = "white";
ctx.fillRect(0, 0, canvas.width, canvas.height);
// drawWindow always draws one canvas pixel for each CSS pixel
// in the source window, so scale the drawing to show the zoom
// (making each canvas pixel be one device pixel instead).
// Fill all pixels that should be *fully* painted by the
// drawWindow call with bgcolor. This fill is scaled manually
// so we can snap it to pixel boundaries.
ctx.fillStyle = bgcolor;
var bbtop = Math.ceil(bbox.top * scale);
var bbleft = Math.ceil(bbox.left * scale);
var bbright = Math.floor(bbox.right * scale);
var bbbottom = Math.floor(bbox.bottom * scale);
ctx.fillRect(bbleft, bbtop, bbright - bbleft, bbbottom - bbtop);
// drawWindow always draws one canvas pixel for each CSS pixel in the source
// window, so scale the drawing to show the zoom (making each canvas pixel be one
// device pixel instead)
ctx.scale(scale, scale);
// Using "transparent" for the last argument prevents
// drawWindow from clearing the canvas, which would negate all
// of the setup above.
ctx.drawWindow(win, win.scrollX, win.scrollY,
Math.ceil(canvas.width / scale),
Math.ceil(canvas.height / scale),
"transparent");
"rgb(255,255,255)");
ctx.restore();
}
if (gState == "test") {
gCanvasTest = canvas;
if (gState == 1) {
gCanvas1 = canvas;
} else {
gCanvasRef = canvas;
gCanvas2 = canvas;
}
resetZoom();
switch (gState) {
case "test":
case 1:
// First document has been loaded.
// Proceed to load the second document.
StartCurrentURI("ref");
StartCurrentURI(2);
break;
case "ref":
case 2:
// Both documents have been loaded. Compare the renderings and see
// if the comparison result matches the expected result specified
// in the manifest.
@ -660,12 +623,12 @@ function DocumentLoaded()
var equal;
if (gWindowUtils) {
differences = gWindowUtils.compareCanvases(gCanvasTest, gCanvasRef, {});
differences = gWindowUtils.compareCanvases(gCanvas1, gCanvas2, {});
equal = (differences == 0);
} else {
differences = -1;
var k1 = gCanvasTest.toDataURL();
var k2 = gCanvasRef.toDataURL();
var k1 = gCanvas1.toDataURL();
var k2 = gCanvas2.toDataURL();
equal = (k1 == k2);
}
@ -701,16 +664,16 @@ function DocumentLoaded()
if (!test_passed && expected == EXPECTED_PASS ||
test_passed && expected == EXPECTED_FAIL) {
if (!equal) {
dump("REFTEST IMAGE 1 (TEST): " + gCanvasTest.toDataURL() + "\n");
dump("REFTEST IMAGE 2 (REFERENCE): " + gCanvasRef.toDataURL() + "\n");
dump("REFTEST IMAGE 1 (TEST): " + gCanvas1.toDataURL() + "\n");
dump("REFTEST IMAGE 2 (REFERENCE): " + gCanvas2.toDataURL() + "\n");
dump("REFTEST number of differing pixels: " + differences + "\n");
} else {
dump("REFTEST IMAGE: " + gCanvasTest.toDataURL() + "\n");
dump("REFTEST IMAGE: " + gCanvas1.toDataURL() + "\n");
}
}
UpdateCanvasCache("test", gURLs[0].urltest, gCanvasTest);
UpdateCanvasCache("ref", gURLs[0].urlref, gCanvasRef);
UpdateCanvasCache(gURLs[0].url1, gCanvas1);
UpdateCanvasCache(gURLs[0].url2, gCanvas2);
gURLs.shift();
StartCurrentTest();