Scripts: Show first 3 diff frames in regression test

This commit is contained in:
Connor McLaughlin 2023-01-11 18:22:23 +10:00
parent 90fe071dda
commit 8d3250667f
1 changed files with 13 additions and 5 deletions

View File

@ -48,6 +48,8 @@ def check_regression_test(baselinedir, testdir, name):
#print("*** %s is missing in test set" % name) #print("*** %s is missing in test set" % name)
return False return False
num_diff = 0
header_written = False
images = glob.glob(os.path.join(dir1, "frame_*.png")) images = glob.glob(os.path.join(dir1, "frame_*.png"))
for imagepath in images: for imagepath in images:
imagename = Path(imagepath).name imagename = Path(imagepath).name
@ -61,21 +63,27 @@ def check_regression_test(baselinedir, testdir, name):
path2 = os.path.join(dir2, imagename) path2 = os.path.join(dir2, imagename)
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))
write("<h1>{}</h1>".format(name)) if not header_written:
write("--- Frame %u for %s is missing in test set" % (framenum, name)) write("<h1>{}</h1>".format(name))
return False header_written = True
write("<p>--- Frame %u for %s is missing in test set</p>" % (framenum, name))
continue
if not compare_frames(path1, path2): if not compare_frames(path1, path2):
print("*** Difference in frame %u for %s" % (framenum, name)) print("*** Difference in frame %u for %s" % (framenum, name))
imguri1 = Path(path1).as_uri() imguri1 = Path(path1).as_uri()
imguri2 = Path(path2).as_uri() imguri2 = Path(path2).as_uri()
write("<h1>{}</h1>".format(name)) if not header_written:
write("<h1>{}</h1>".format(name))
header_written = True
write("<table width=\"100%\">") write("<table width=\"100%\">")
write("<tr><td colspan=\"2\">Frame {}</td></tr>".format(framenum)) write("<tr><td colspan=\"2\">Frame {}</td></tr>".format(framenum))
write("<tr><td><img src=\"{}\" /></td><td><img src=\"{}\" /></td></tr>".format(imguri1, imguri2)) write("<tr><td><img src=\"{}\" /></td><td><img src=\"{}\" /></td></tr>".format(imguri1, imguri2))
write("</table>") write("</table>")
return False num_diff += 1
if (num_diff >= 3):
return False
return True return True