[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30282] branches/soc-2010-leifandersen/ tests/render/run.py: A lot more bug fixes... now relating to hash-tests and getting the hash codes.
Leif Andersen
leif.a.andersen at gmail.com
Tue Jul 13 21:55:39 CEST 2010
Revision: 30282
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30282
Author: leifandersen
Date: 2010-07-13 21:55:39 +0200 (Tue, 13 Jul 2010)
Log Message:
-----------
A lot more bug fixes...now relating to hash-tests and getting the hash codes. Also, output is produced for the hash tests.
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-13 19:52:04 UTC (rev 30281)
+++ branches/soc-2010-leifandersen/tests/render/run.py 2010-07-13 19:55:39 UTC (rev 30282)
@@ -62,6 +62,9 @@
def __init__(self):
self.name = 'Uninitialized'
+ self.good_hash = -1
+ self.test_hash = -1
+ self.diff_hash = -1
def setup_hash(self, blend_path, good_hash, test_path):
self.name = os.path.split(blend_path)[1]
@@ -86,6 +89,8 @@
self.mode = 'Fail'
self.good_image = None
self.good_hash = -1
+ self.test_hash = -1
+ self.diff_hash = -1
def generate_hash(self, image):
hash = 0
@@ -126,6 +131,9 @@
self.diff_sum = 0
self.difference = 0
self.message = "Failed to render"
+ self.good_hash = -1
+ self.test_hash = -1
+ self.diff_hash = -1
def image_test(self):
'''Runs the test, filling in all of the usefull fields'''
@@ -157,6 +165,11 @@
return self.passed
def hash_test(self):
+ if self.test_image == None:
+ try:
+ self.test_image = Image.open(self.test_path)
+ except IOError:
+ self.passed = False
if self.test_image != None:
if self.good_hash == None:
if self.good_image != None:
@@ -242,6 +255,9 @@
self.test_hash_arr = []
self.diff_hash_arr = []
self.ID = 'Animation'
+ self.good_hash = -1
+ self.test_hash = -1
+ self.diff_hash = -1
def setup_hash(self, blend_path, good_hash, test_path):
''''''
@@ -279,11 +295,15 @@
self.mode = 'Fail'
self.good_image = None
self.good_hash = -1
+ self.test_hash = -1
+ self.diff_hash = -1
self.test_path = os.path.join(test_path, string.replace(self.name, '.blend', '_0001.png'))
except OSError:
self.mode = 'Fail'
self.good_image = None
self.good_hash = -1
+ self.test_hash = -1
+ self.diff_hash = -1
self.test_path = os.path.join(test_path, string.replace(self.name, '.blend', '_0001.png'))
def generate_hash(self, animation):
@@ -321,7 +341,6 @@
self.test_animation.append(im)
if len(self.test_animation) > 0:
self.test_image = self.test_animation[0]
- self.test_hash = self.generate_hash(self.test_animation)
except IOError:
self.mdoe = 'Fail'
self.test_image = None
@@ -333,6 +352,9 @@
self.difference = 0
self.message = "Failed to render"
self.test_hash = None
+ self.good_hash = -1
+ self.test_hash = -1
+ self.diff_hash = -1
def image_test(self):
''''''
@@ -384,6 +406,19 @@
self.passed = False
def hash_test(self):
+ if self.test_image == None:
+ try:
+ for imagename in self.test_path_arr:
+ im = Image.open(imagename)
+ self.test_animation.append(im)
+ if len(self.test_animation) > 0:
+ self.test_image = self.test_animation[0]
+ except IOError:
+ self.passed = False
+ self.good_hash = -1
+ self.test_hash = -1
+ self.diff_hash = -1
+
if self.test_image != None:
if self.good_hash == None:
if self.good_image != None:
@@ -536,14 +571,16 @@
anim_output(image, os.path.join(output_directory, string.replace(image.name, '.blend', '.html')))
else:
file.write('<td>' + image.name + '</td>\n')
- file.write('<td><a href="' + image.good_path + '"><img src="' + image.good_path + '" alt="Good Image" width="200" height="150"></a></td>\n')
- file.write('<td><a href="' + image.test_path + '"><img src="' + image.test_path + '" alt="Latest Render" width="200" height="150"></a></td>\n')
- file.write('<td><a href="' + image.diff_path + '"><img src="' + image.diff_path + '" alt="Image Diff" width="200" height="150"></a></td>\n')
+ if image.mode == 'Image':
+ file.write('<td><a href="' + image.good_path + '"><img src="' + image.good_path + '" alt="Good Image" width="200" height="150"></a></td>\n')
+ file.write('<td><a href="' + image.test_path + '"><img src="' + image.test_path + '" alt="Latest Render" width="200" height="150"></a></td>\n')
+ file.write('<td><a href="' + image.diff_path + '"><img src="' + image.diff_path + '" alt="Image Diff" width="200" height="150"></a></td>\n')
+ elif image.mode == 'Hash':
+ file.write('<td>' + str(image.good_hash) + '</td>')
+ file.write('<td>' + str(image.test_hash) + '</td>')
+ file.write('<td>' + str(image.diff_hash) + '</td>')
file.write('<td>')
- if image.passed:
- file.write('<font color="ooffoo">OK</font>: ' + str(image.bad_pixels) + ' of ' + str(image.pixel_count) + ' pixels different, ' + str(image.difference) + '% different.')
- else:
- file.write('<font color="ff0000">FAIL</font>: ' + str(image.bad_pixels) + ' of ' + str(image.pixel_count) + ' pixels different, ' + str(image.difference) + '% different.')
+ file.write('<font color="ff0000">FAIL</font>: ' + str(image.bad_pixels) + ' of ' + str(image.pixel_count) + ' pixels different, ' + str(image.difference) + '% different.')
if image.message != None:
file.write(" " + image.message)
file.write('</td>\n</tr>\n')
@@ -567,14 +604,16 @@
anim_output(image, os.path.join(output_directory, string.replace(image.name, '.blend', '.html')))
else:
file.write('<td>' + image.name + '</td>\n')
- file.write('<td><a href="' + image.good_path + '"><img src="' + image.good_path + '" alt="Good Image" width="200" height="150"></a></td>\n')
- file.write('<td><a href="' + image.test_path + '"><img src="' + image.test_path + '" alt="Latest Render" width="200" height="150"></a></td>\n')
- file.write('<td><a href="' + image.diff_path + '"><img src="' + image.diff_path + '" alt="Image Diff" width="200" height="150"></a></td>\n')
+ if image.mode == 'Image':
+ file.write('<td><a href="' + image.good_path + '"><img src="' + image.good_path + '" alt="Good Image" width="200" height="150"></a></td>\n')
+ file.write('<td><a href="' + image.test_path + '"><img src="' + image.test_path + '" alt="Latest Render" width="200" height="150"></a></td>\n')
+ file.write('<td><a href="' + image.diff_path + '"><img src="' + image.diff_path + '" alt="Image Diff" width="200" height="150"></a></td>\n')
+ elif image.mode == 'Hash':
+ file.write('<td>' + str(image.good_hash) + '</td>')
+ file.write('<td>' + str(image.test_hash) + '</td>')
+ file.write('<td>' + str(image.diff_hash) + '</td>')
file.write('<td>')
- if image.passed:
- file.write('<font color="ooffoo">OK</font>: ' + str(image.bad_pixels) + ' of ' + str(image.pixel_count) + ' pixels different, ' + str(image.difference) + '% different.')
- else:
- file.write('<font color="ff0000">FAIL</font>: ' + str(image.bad_pixels) + ' of ' + str(image.pixel_count) + ' pixels different, ' + str(image.difference) + '% different.')
+ file.write('<font color="ooffoo">OK</font>: ' + str(image.bad_pixels) + ' of ' + str(image.pixel_count) + ' pixels different, ' + str(image.difference) + '% different.')
if image.message != None:
file.write(" " + image.message)
file.write('</td>\n</tr>\n')
@@ -844,7 +883,7 @@
print 'FAILED'
# Output Result
- if not BUILDING_TESTS and not HASHCODE_TEST:
+ if not BUILDING_TESTS:
print 'Generating Output'
generate_css(os.path.join(HTML_OUTPUT, 'style.css'))
generate_output(cases, os.path.join(HTML_OUTPUT, 'index.html'))
More information about the Bf-blender-cvs
mailing list