[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30185] branches/soc-2010-leifandersen/ tests/render/run.py: 1.

Leif Andersen leif.a.andersen at gmail.com
Sat Jul 10 18:51:59 CEST 2010


Revision: 30185
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30185
Author:   leifandersen
Date:     2010-07-10 18:51:59 +0200 (Sat, 10 Jul 2010)

Log Message:
-----------
1.  The --animation flag now works, enter the path for the animation blend file.  

2.  --run-animations run's the animation tests, as well as the image tests.  (Asuming the animtation tests have been built).

3.  Started fixing up HTML output for animations.

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-10 16:19:07 UTC (rev 30184)
+++ branches/soc-2010-leifandersen/tests/render/run.py	2010-07-10 16:51:59 UTC (rev 30185)
@@ -213,6 +213,7 @@
         self.good_hash_arr = []
         self.test_hash_arr = []
         self.diff_hash_arr = []
+        self.ID = 'Animation'
 
     def setup_hash(self, blend_path, good_hash, test_path):
         ''''''
@@ -265,12 +266,11 @@
     def render_test(self):
         ''''''
         if VERBOSE:
-            command = BLENDER_BIN + " -b " + self.blend_path + " -o " + string.replace(self.test_path, '_0001.png', '') + "_#### -F PNG -x 1 -a"
+            command = BLENDER_BIN + ' -b ' + self.blend_path + " -o " + string.replace(self.test_path, '_0001.png', '') + '_#### -F PNG -x 1 -a'
             os.system(command)
         else:
-            p = Popen([BLENDER_BIN, '-b', self.blend_path, '-o', string.replace(self.test_path, '_0001.png', '') + '_####', '-F', 'PNG', '-x', '1', '-a'], stdout=None, stderr=None, stdin=None)
+            p = Popen([BLENDER_BIN, '-b', self.blend_path, '-o', string.replace(self.test_path, '_0001.png', '_####'), '-F', 'PNG', '-x', '1', '-a'], stdout=None, stderr=None, stdin=None)
             p.wait()
-
         try:
             for imagename in self.test_path_arr:
                 im = Image.open(imagename)
@@ -296,10 +296,7 @@
             for diff_image in self.good_animation:
                 im = ImageChops.difference(self.good_image, self.test_image)
                 self.diff_animation.append(im)
-                self.diff_hash_arr.append(im)
-            self.diff_hash = 0
-            for num in self.diff_hash_arr:
-                self.diff_hash+=num
+#            self.diff_hash = self.generate_hash(self.good_animation)
             self.diff_image = self.diff_animation[0]
 
             for diff_image in self.diff_animation:
@@ -431,7 +428,11 @@
     for image in images:
         if image.passed == False:
             file.write('<tr>\n')
-            file.write('<td>' +  image.name + '</td>\n')
+            if image.ID == 'Animation':
+                file.write('<td><a href="' + string.replace(image.name, '.blend', '.html') + '">' + image.name + '</a></td>\n')
+                anim_output(imaage, os.path.join(output_folder, 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')
@@ -458,7 +459,11 @@
     for image in images:
         if image.passed == True:
             file.write('<tr>\n')
-            file.write('<td>' +  image.name + '</td>\n')
+            if image.ID == 'Animation':
+                file.write('<td><a href="' + string.replace(image.name, '.blend', '.html') + '">' + image.name + '</a></td>\n')
+                anim_output(imaage, os.path.join(output_folder, 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')
@@ -634,8 +639,16 @@
     for arg in sys.argv:
         if arg == '--blender-bin' and len(sys.argv) > argv_i:
             BLENDER_BIN = sys.argv[argv_i + 1]
-        if arg == '--animations':
-            RUN_ANIMATIONS = True
+        if arg == '--animation' and len(sys.argv) > argv_i:
+            RUN_IMAGES = False
+            argv_path = sys.argv[argv_i + 1]
+            (argv_directory, argv_file) = os.path.split(argv_path)
+            case = AnimationTestCase()
+            case.setup_image(argv_path, os.path.join(argv_directory, string.replace(argv_file, '.blend', '')), os.path.join(argv_directory, 'output', string.replace(argv_file, '.blend', '')))
+            cases.append(case)
+        if arg == '--run-animations':
+            RUN_IMAGES_AND_ANIMATIONS = True
+            RUN_IMAGES = False
         if arg == '--image' and len(sys.argv) > argv_i:
             RUN_IMAGES = False
             argv_path = sys.argv[argv_i + 1]





More information about the Bf-blender-cvs mailing list