[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31220] branches/soc-2010-leifandersen: A few tweeks to the image diff script ( in preperation to package the final product).

Leif Andersen leif.a.andersen at gmail.com
Tue Aug 10 21:12:30 CEST 2010


Revision: 31220
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31220
Author:   leifandersen
Date:     2010-08-10 21:12:30 +0200 (Tue, 10 Aug 2010)

Log Message:
-----------
A few tweeks to the image diff script (in preperation to package the final product).

1.  Increased the requirements to pass by quite a bit, thus a lot more tests now fail.  Will dial down if needed to.

2.  Changed the tests back to percent notation (didn't realize I was using percent notation, with a decimal difference), also, if the tests failed to render, better results are shown (as apposed to None%).

Also, a few tweeks to the hash operator, in an attempt to figure out what is causing the hash to be system dependent, but it's not going well so far...

Modified Paths:
--------------
    branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py
    branches/soc-2010-leifandersen/tests/render/run.py

Modified: branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py
===================================================================
--- branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py	2010-08-10 18:21:33 UTC (rev 31219)
+++ branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py	2010-08-10 19:12:30 UTC (rev 31220)
@@ -171,7 +171,8 @@
                         hashcode.update(str(face.smooth).encode())
                         hashcode.update(str(face.select).encode())
                         hashcode.update(str(face.hide).encode())
-                        hashcode.update(str(len(face.verts)).encode())
+                        for vert in face.verts:
+                            hashcode.update(str(vert).encode())
                         for point in face.center:
                             hashcode.update(str(point).encode())
                         for pair in face.edge_keys:

Modified: branches/soc-2010-leifandersen/tests/render/run.py
===================================================================
--- branches/soc-2010-leifandersen/tests/render/run.py	2010-08-10 18:21:33 UTC (rev 31219)
+++ branches/soc-2010-leifandersen/tests/render/run.py	2010-08-10 19:12:30 UTC (rev 31220)
@@ -140,7 +140,7 @@
             self.difference = float(self.diff_sum)/float(self.pixel_range*self.pixel_count)
             
             # Set pass/fail
-            if self.bad_pixels < self.pixel_count/5 and self.difference < 0.01:
+            if self.bad_pixels < self.pixel_count/20 and self.difference < 0.01:
                 self.passed = True
             else:
                 self.passed = False
@@ -292,7 +292,7 @@
                 difference = float(diff_sum)/float(pixel_range*pixel_count)
                 
                 # Determine if particular frame passed
-                if bad_pixels < pixel_count/5 and difference < 0.01:
+                if bad_pixels < pixel_count/20 and difference < 0.01:
                     self.passed_arr.append(True)
                 else:
                     self.passed_arr.append(False)
@@ -303,13 +303,19 @@
                 self.pixel_range_arr.append(pixel_range)
                 self.pixel_count_arr.append(pixel_count)
 
-            # Set the values of still image (to be ImageTestCase compliet)
-            self.diff_sum = self.diff_sum_arr[0]
-            self.bad_pixels = self.bad_pixels_arr[0]
-            self.pixel_range = self.pixel_range_arr[0]
+            # Set the values of still image (to be ImageTestCase compelet)
+            self.diff_sum = 0
+            for num in self.diff_sum_arr:
+                self.diff_sum += num
+            self.bad_pixels = 0
+            for num in self.bad_pixels_arr:
+                self.bad_pixels += num
+            self.pixel_range = 0
+            for num in self.pixel_range_arr:
+                self.pixel_range += num
             self.pixel_count = 0
             for num in self.pixel_count_arr:
-                self.pixel_count+=num
+                self.pixel_count += num
             
             self.passed = True
             fail_count = 0
@@ -317,7 +323,7 @@
             for passed in self.passed_arr:
                 if passed == False:
                     fail_count+=1
-            if fail_count > frames/50:
+            if fail_count > frames/100:
                 self.passed = False
         except (TypeError, AttributeError):
             # In case image didn't render, or something else went wrong
@@ -457,9 +463,15 @@
         file.write('<td><a href="file://' + animation.diff_path_arr[i-1] + '"><img src="file://' + animation.diff_path_arr[i-1] + '" alt="Image Diff" width="200" height="150"></a></td>\n')
         file.write('<td>')
         if animation.passed_arr[i-1]:
-            file.write('<font color="ooffoo">OK</font>: ' + str(animation.bad_pixels_arr[i-1]) + ' of ' + str(animation.pixel_count_arr[i-1]) + ' pixels different, ' + str(animation.difference) + '% different.')
+            if animation.bad_pixles_arr[i-1] and animation.pixel_count_arr[i-1] and animation.difference:
+                file.write('<font color="ooffoo">OK</font>: ' + str(animation.bad_pixels_arr[i-1]) + ' of ' + str(animation.pixel_count_arr[i-1]) + ' pixels different, ' + str(animation.difference*100) + '% different.')
+            else:
+                file.write('<font color="ff0000">FAIL</font>: Problem Analyzing Picture')
         else:
-            file.write('<font color="ff0000">FAIL</font>: ' + str(animation.bad_pixels_arr[i-1]) + ' of ' + str(animation.pixel_count_arr[i-1]) + ' pixels different, ' + str(animation.difference) + '% different.')
+            if animation.bad_pixles_arr[i-1] and animation.pixel_count_arr[i-1] and animation.difference:
+                file.write('<font color="ff0000">FAIL</font>: ' + str(animation.bad_pixels_arr[i-1]) + ' of ' + str(animation.pixel_count_arr[i-1]) + ' pixels different, ' + str(animation.difference*100) + '% different.')
+            else:
+                file.write('<font color="ff0000">FAIL</font>: Problem Analyzing Picture')
         if animation.message != None:
             file.write(" " + animation.message)
         file.write('</td>\n</tr>\n')
@@ -514,7 +526,10 @@
             file.write('<td><a href="file://' + image.test_path + '"><img src="file://' + image.test_path + '" alt="Latest Render" width="200" height="150"></a></td>\n')
             file.write('<td><a href="file://' + image.diff_path + '"><img src="file://' + image.diff_path + '" alt="Image Diff" width="200" height="150"></a></td>\n')
             file.write('<td>')
-            file.write('<font color="ff0000">FAIL</font>: ' + str(image.bad_pixels) + ' of ' + str(image.pixel_count) + ' pixels different, ' + str(image.difference) + '% different.')
+            if image.bad_pixels != None and image.pixel_count != None and image.difference != None:
+                file.write('<font color="ff0000">FAIL</font>: ' + str(image.bad_pixels) + ' of ' + str(image.pixel_count) + ' pixels different, ' + str(image.difference*100) + '% different.')
+            else:
+                file.write('<font color="ff0000">FAIL</font>: Problem Analyzing Picture')
             if image.message != None:
                 file.write(" " + image.message)
             file.write('</td>\n</tr>\n')
@@ -543,7 +558,10 @@
             file.write('<td><a href="file://' + image.test_path + '"><img src="file://' + image.test_path + '" alt="Latest Render" width="200" height="150"></a></td>\n')
             file.write('<td><a href="file://' + image.diff_path + '"><img src="file://' + image.diff_path + '" alt="Image Diff" width="200" height="150"></a></td>\n')
             file.write('<td>')
-            file.write('<font color="ooffoo">OK</font>: ' + str(image.bad_pixels) + ' of ' + str(image.pixel_count) + ' pixels different, ' + str(image.difference) + '% different.')
+            if image.bad_pixels != None and image.pixel_count != None and image.difference != None:
+                file.write('<font color="ooffoo">OK</font>: ' + str(image.bad_pixels) + ' of ' + str(image.pixel_count) + ' pixels different, ' + str(image.difference*100) + '% different.')
+            else:
+                file.write('<font color="ff0000">FAIL</font>: Problem Analyzing Picture')
             if image.message != None:
                 file.write(" " + image.message)
             file.write('</td>\n</tr>\n')





More information about the Bf-blender-cvs mailing list