diff --git a/test/resources/reftest-analyzer.xhtml b/test/resources/reftest-analyzer.xhtml
index e4071f232..f914d297e 100644
--- a/test/resources/reftest-analyzer.xhtml
+++ b/test/resources/reftest-analyzer.xhtml
@@ -110,6 +110,7 @@ var gMagZoom = 16; // size of the zoomed in pixels
var gImage1Data; // ImageData object for the reference image
var gImage2Data; // ImageData object for the test output image
var gFlashingPixels = []; // array of objects that should be flashed due to pixel color mismatch
+var gPath = ''; // path taken from #web= and prepended to ref/snp urls
function ID(id) {
if (!(id in gIDCache))
@@ -190,6 +191,11 @@ function show_phase(phaseid) {
}
function loadFromWeb(url) {
+ var lastSlash = url.lastIndexOf('/');
+ if (lastSlash) {
+ gPath = url.substring(0, lastSlash + 1);
+ }
+
var r = new XMLHttpRequest();
r.open("GET", url);
r.onreadystatechange = function() {
@@ -344,7 +350,7 @@ function get_image_data(src, whenReady) {
whenReady(ctx.getImageData(0, 0, 800, 1000));
};
- img.src = src;
+ img.src = gPath + src;
}
function show_images(i) {
@@ -356,17 +362,17 @@ function show_images(i) {
ID("diffrect").style.display = "none";
ID("imgcontrols").reset();
- ID("image1").setAttributeNS(XLINK_NS, "xlink:href", item.images[0]);
+ ID("image1").setAttributeNS(XLINK_NS, "xlink:href", gPath + item.images[0]);
// Making the href be #image1 doesn't seem to work
- ID("feimage1").setAttributeNS(XLINK_NS, "xlink:href", item.images[0]);
+ ID("feimage1").setAttributeNS(XLINK_NS, "xlink:href", gPath + item.images[0]);
if (item.images.length == 1) {
ID("imgcontrols").style.display = "none";
} else {
ID("imgcontrols").style.display = "";
- ID("image2").setAttributeNS(XLINK_NS, "xlink:href", item.images[1]);
+ ID("image2").setAttributeNS(XLINK_NS, "xlink:href", gPath + item.images[1]);
// Making the href be #image2 doesn't seem to work
- ID("feimage2").setAttributeNS(XLINK_NS, "xlink:href", item.images[1]);
+ ID("feimage2").setAttributeNS(XLINK_NS, "xlink:href", gPath + item.images[1]);
}
cell.style.display = "";
diff --git a/test/test.py b/test/test.py
index 79e825831..67b7acefe 100644
--- a/test/test.py
+++ b/test/test.py
@@ -694,12 +694,17 @@ def checkEq(task, results, browser, masterMode):
handle.write(snapshot)
handle.close()
+ refSnapshotPath = os.path.join(testSnapshotDir, str(page) + '_ref.png')
+ handle = open(refSnapshotPath, 'wb')
+ handle.write(ref)
+ handle.close()
+
# NB: this follows the format of Mozilla reftest
# output so that we can reuse its reftest-analyzer
# script
eqLog.write('REFTEST TEST-UNEXPECTED-FAIL | ' + browser +'-'+ taskId +'-page'+ str(page) + ' | image comparison (==)\n')
- eqLog.write('REFTEST IMAGE 1 (TEST): ' + '/test/' + testSnapshotPath + '\n')
- eqLog.write('REFTEST IMAGE 2 (REFERENCE): ' + '/test/' + path + '\n')
+ eqLog.write('REFTEST IMAGE 1 (TEST): ' + testSnapshotPath + '\n')
+ eqLog.write('REFTEST IMAGE 2 (REFERENCE): ' + refSnapshotPath + '\n')
passed = False
State.numEqFailures += 1
@@ -793,6 +798,11 @@ def startReftest(browser, options):
print "Completed reftest usage."
def runTests(options, browsers):
+ try:
+ shutil.rmtree(TEST_SNAPSHOTS);
+ except OSError, e:
+ if e.errno != 2: # folder doesn't exist
+ print >>sys.stderr, 'Deleting', dir, 'failed!'
t1 = time.time()
try:
startBrowsers(browsers, options, '/test/test_slave.html')