[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29807] branches/soc-2010-leifandersen: More modifications to run.py file.
Leif Andersen
leif.a.andersen at gmail.com
Wed Jun 30 02:17:02 CEST 2010
Revision: 29807
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29807
Author: leifandersen
Date: 2010-06-30 02:17:02 +0200 (Wed, 30 Jun 2010)
Log Message:
-----------
More modifications to run.py file. It can now creates an index.html file, which serves as a static table allowing you to easily compare images side by side. Although the Match collom always returns true.
Also, I just realized that the BLENDER_BIN variable is currently unique to me, it needs to be manually changed. Will be fixed soon.
Modified Paths:
--------------
branches/soc-2010-leifandersen/release/scripts/op/tests_render.py
branches/soc-2010-leifandersen/tests/render/run.py
Modified: branches/soc-2010-leifandersen/release/scripts/op/tests_render.py
===================================================================
--- branches/soc-2010-leifandersen/release/scripts/op/tests_render.py 2010-06-29 22:30:55 UTC (rev 29806)
+++ branches/soc-2010-leifandersen/release/scripts/op/tests_render.py 2010-06-30 00:17:02 UTC (rev 29807)
@@ -65,7 +65,7 @@
def execute(self, context):
(directory, filename) = os.path.split(self.properties.filepath)
for file in os.listdir(directory):
- if file != 'output' and file != 'render' and file != 'anim' and file != 'piltest.py':
+ if file != 'output' and file != 'render' and file != 'anim' and file != PILTEST_PY:
bpy.ops.tests.render(filepath=self.properties.filepath)
return {'FINISHED'}
Modified: branches/soc-2010-leifandersen/tests/render/run.py
===================================================================
--- branches/soc-2010-leifandersen/tests/render/run.py 2010-06-29 22:30:55 UTC (rev 29806)
+++ branches/soc-2010-leifandersen/tests/render/run.py 2010-06-30 00:17:02 UTC (rev 29807)
@@ -5,19 +5,18 @@
BLENDER_BIN = "/home/leif/blender-svn/blender-build/bin/blender"
-def render(file):
- command = BLENDER_BIN + " -b " + os.path.join(sys.path[0], file) + " -o " + os.path.join(sys.path[0], "output", (file + "_####")) + " -F PNG -x 1 -f 1"
+def render(filename):
+ command = BLENDER_BIN + " -b " + os.path.join(sys.path[0], filename) + " -o " + os.path.join(sys.path[0], "output", (filename + "_####")) + " -F PNG -x 1 -f 1"
os.system(command)
- return os.path.join(sys.path[0], "output", file, "_0001.png")
+ return os.path.join(sys.path[0], "output", filename, "_0001.png")
+
class TestImage(unittest.TestCase):
im1 = None
im2 = None
def setUp(self):
- image_path1 = os.path.join(sys.path[0], 'render', file + '.png')
- image_path2 = os.path.join(sys.path[0], 'output', file + '_0001.png')
self.im1 = Image.open(image_path1)
self.im2 = Image.open(image_path2)
@@ -99,14 +98,45 @@
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == '--blender-intern':
+ # If this is run in blender, than the images already exist
+ # and only comparisons need to take place.
unittest.TextTestRunner(verbosity=2).run(operator_suite())
else:
- for file in os.listdir(sys.path[0]):
- if file != 'output' and file != 'render' and file != 'anim' and file != '.svn' and file != sys.argv[0]:
- print file
- render(file)
+ # Otherwise render the tests, and generate HTML output
+
+ #Setting up the HTML File
+ file = open(os.path.join(sys.path[0],"index.html"), "w")
+ file.write('<html><head><title>Render Test Output</title></head>\n')
+ file.write('<body>\n<table boarder="1">\n')
+ file.write('<tr>\n')
+ file.write('<th>Filename</th>\n')
+ file.write('<th>Good Image</th>\n')
+ file.write('<th>Latest Render</th>\n')
+ file.write('<th>Math/Different</th>\n')
+ file.write('</tr>\n')
+
+ # Main Test Loop
+ # 1. Render Tests
+ # 2. Analyze images
+ # 3. Report Output
+ for filename in os.listdir(sys.path[0]):
+ if filename != 'output' and filename != 'render' and filename != 'anim' and filename != '.svn' and filename != 'index.html' and filename != sys.argv[0]:
+ print filename
+ render(filename)
unittest.TextTestRunner(verbosity=2).run(suite())
+ file.write('<tr>\n')
+ file.write('<td>' + filename + '</td>\n')
+ file.write('<td><img src="' + os.path.join('render', filename + '.png') + '" alt="Good Image" width="200" height="150"></td>\n')
+ file.write('<td><img src="' + os.path.join('output', filename + '_0001.png') + '" alt="Latest Render" width="200" height="150"></td>\n')
+ file.write('<td>Match</td>\n')
+ file.write('<tr>\n')
+
+ # Finish up
+ # 1. Report final output to console
+ # 2. Finish HTML file
# if(unittest.TestResult.wasSuccessful()):
# print "All tests passed"
# else:
# print unittest.TestResult.failures
+ file.write('</table>\n</body>\n</html>')
+ file.close()
More information about the Bf-blender-cvs
mailing list