RegTest: Fix compare with only missing but no diffs
This commit is contained in:
parent
8d94fd54f2
commit
5d5c04c9b4
|
@ -161,11 +161,14 @@ function formatLines(str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractItem(elem) {
|
function extractItem(elem) {
|
||||||
|
var beforeSel = elem.querySelector(".before");
|
||||||
|
var afterSel = elem.querySelector(".after");
|
||||||
|
var preSel = elem.querySelector("pre");
|
||||||
return {
|
return {
|
||||||
name: elem.querySelector("h1").innerText,
|
name: elem.querySelector("h1").innerText,
|
||||||
beforeImg: elem.querySelector(".before").getAttribute("src"),
|
beforeImg: beforeSel ? beforeSel.getAttribute("src") : null,
|
||||||
afterImg: elem.querySelector(".after").getAttribute("src"),
|
afterImg: afterSel ? afterSel.getAttribute("src") : null,
|
||||||
details: formatLines(elem.querySelector("pre").innerText)
|
details: formatLines(preSel ? preSel.innerText : "")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,6 +279,7 @@ def check_regression_test(baselinedir, testdir, name):
|
||||||
images = glob.glob(os.path.join(dir1, "frame_*.png"))
|
images = glob.glob(os.path.join(dir1, "frame_*.png"))
|
||||||
diff_frames = []
|
diff_frames = []
|
||||||
first_fail = True
|
first_fail = True
|
||||||
|
has_any = False
|
||||||
|
|
||||||
for imagepath in images:
|
for imagepath in images:
|
||||||
imagename = Path(imagepath).name
|
imagename = Path(imagepath).name
|
||||||
|
@ -290,11 +294,14 @@ def check_regression_test(baselinedir, testdir, name):
|
||||||
if not os.path.isfile(path2):
|
if not os.path.isfile(path2):
|
||||||
print("--- Frame %u for %s is missing in test set" % (framenum, name))
|
print("--- Frame %u for %s is missing in test set" % (framenum, name))
|
||||||
if first_fail:
|
if first_fail:
|
||||||
|
write("<div class=\"item\">")
|
||||||
write("<h1>{}</h1>".format(name))
|
write("<h1>{}</h1>".format(name))
|
||||||
|
write("<table width=\"100%\">")
|
||||||
first_fail = False
|
first_fail = False
|
||||||
write("<p>--- Frame %u for %s is missing in test set</p>" % (framenum, name))
|
write("<p>--- Frame %u for %s is missing in test set</p>" % (framenum, name))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
has_any = True
|
||||||
if not compare_frames(path1, path2):
|
if not compare_frames(path1, path2):
|
||||||
diff_frames.append(framenum)
|
diff_frames.append(framenum)
|
||||||
|
|
||||||
|
@ -312,11 +319,12 @@ def check_regression_test(baselinedir, testdir, name):
|
||||||
if len(diff_frames) == MAX_DIFF_FRAMES:
|
if len(diff_frames) == MAX_DIFF_FRAMES:
|
||||||
break
|
break
|
||||||
|
|
||||||
if len(diff_frames) > 0:
|
if not first_fail:
|
||||||
write("</table>")
|
write("</table>")
|
||||||
write("<pre>Difference in frames [%s] for %s</pre>" % (",".join(map(str, diff_frames)), name))
|
write("<pre>Difference in frames [%s] for %s</pre>" % (",".join(map(str, diff_frames)), name))
|
||||||
write("</div>")
|
write("</div>")
|
||||||
print("*** Difference in frames [%s] for %s" % (",".join(map(str, diff_frames)), name))
|
print("*** Difference in frames [%s] for %s" % (",".join(map(str, diff_frames)), name))
|
||||||
|
#assert has_any
|
||||||
|
|
||||||
return len(diff_frames) == 0
|
return len(diff_frames) == 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue