[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29857] branches/soc-2010-leifandersen/ tests/render/run.py: Andrea recomended some code cleanup, which I' m going to implement, but I wanted this last feature in the history before I took an axe to the code .
Leif Andersen
leif.a.andersen at gmail.com
Thu Jul 1 23:09:45 CEST 2010
Revision: 29857
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29857
Author: leifandersen
Date: 2010-07-01 23:09:45 +0200 (Thu, 01 Jul 2010)
Log Message:
-----------
Andrea recomended some code cleanup, which I'm going to implement, but I wanted this last feature in the history before I took an axe to the code.
1. It now outputes the amounts of pixels that failed, compared to the amount of pixels in the image.
Modified Paths:
--------------
branches/soc-2010-leifandersen/tests/render/run.py
Modified: branches/soc-2010-leifandersen/tests/render/run.py
===================================================================
--- branches/soc-2010-leifandersen/tests/render/run.py 2010-07-01 19:57:40 UTC (rev 29856)
+++ branches/soc-2010-leifandersen/tests/render/run.py 2010-07-01 21:09:45 UTC (rev 29857)
@@ -32,13 +32,18 @@
self.diff.save(os.path.join(sys.path[0], 'output', string.replace(filename, '.blend', '_diff.png')) , "PNG")
def test_diff(self):
+ global bad_pixels
+ global pixel_count
bad_pixels = 0
+ pixel_count = len(self.diff.histogram())
for num in self.diff.histogram():
- if num > 100:
+ if num > 300:
bad_pixels+=1
- if bad_pixels > len(self.diff.histogram())/10:
+ if bad_pixels > pixel_count/10:
self.fail("Images are too different: " + str(bad_pixels))
+
+# This class is only run use when being called from by the operator in blender.
class TestImageOperator(unittest.TestCase):
def setUp(self):
pass
@@ -111,6 +116,8 @@
# 3. Report Output
for filename in os.listdir(sys.path[0]):
if filename.find('.blend') != -1:
+ pixel_count = 0
+ bad_pixels = 0
print filename
render(filename)
tr = unittest.TextTestRunner(verbosity=2).run(suite())
@@ -121,12 +128,11 @@
file.write('<td><img src="' + os.path.join('output', string.replace(filename, '.blend', '_diff.png')) + '" alt="Image Diff" width="200" height="150"></td>\n')
if tr.wasSuccessful():
passed.append(filename)
- file.write('<td><font color="ooffoo">OK</font></td>\n')
+ file.write('<td><font color="ooffoo">OK</font>: ' + str(bad_pixels) + ' of ' + str(pixel_count) + ' pixels different</td>\n')
else:
failed.append(filename)
- file.write('<td><font color="ff0000">FAIL</font></td>\n')
+ file.write('<td><font color="ff0000">FAIL</font>: ' + str(bad_pixels) + ' of ' + str(pixel_count) + ' pixels different</td>\n')
file.write('<tr>\n')
-
# Finish up
# 1. Report final output to console
# 2. Finish HTML file
More information about the Bf-blender-cvs
mailing list