snapdiff: Add filename column to HTML report
authorCarl Worth <cworth@cworth.org>
Tue, 3 Apr 2012 22:18:00 +0000 (15:18 -0700)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 11 Apr 2012 13:39:17 +0000 (14:39 +0100)
Basically, I want one cell that will always be present for turning the
cell green or red based on whether the images match or not.

Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
scripts/snapdiff.py

index 53d9f82..291b2da 100755 (executable)
@@ -134,7 +134,6 @@ def is_image(path):
 
 
 def find_images(prefix):
-    prefix = os.path.abspath(prefix)
     if os.path.isdir(prefix):
         prefix_dir = prefix
     else:
@@ -192,7 +191,7 @@ def main():
     html.write('<html>\n')
     html.write('  <body>\n')
     html.write('    <table border="1">\n')
-    html.write('      <tr><th>%s</th><th>%s</th><th>&Delta;</th></tr>\n' % (ref_prefix, src_prefix))
+    html.write('      <tr><th>File</th><th>%s</th><th>%s</th><th>&Delta;</th></tr>\n' % (ref_prefix, src_prefix))
     for image in images:
         ref_image = ref_prefix + image
         src_image = src_prefix + image
@@ -208,6 +207,7 @@ def main():
                 comparer.write_diff(delta_image, fuzz=options.fuzz)
 
             html.write('      <tr>\n')
+            html.write('        <td>%s</td>\n' % (image,))
             surface(html, ref_image)
             surface(html, src_image)
             surface(html, delta_image)