[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30233] branches/soc-2010-leifandersen/ tests/render/run.py: Fixed weird bug where the test cases for animations wouldn't be generated.

Leif Andersen leif.a.andersen at gmail.com
Mon Jul 12 18:24:43 CEST 2010


Revision: 30233
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30233
Author:   leifandersen
Date:     2010-07-12 18:24:43 +0200 (Mon, 12 Jul 2010)

Log Message:
-----------
Fixed weird bug where the test cases for animations wouldn't be generated.

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-12 16:21:48 UTC (rev 30232)
+++ branches/soc-2010-leifandersen/tests/render/run.py	2010-07-12 16:24:43 UTC (rev 30233)
@@ -17,7 +17,7 @@
 VERBOSE = False
 SAVEOUT = sys.stdout
 BLEND_FILE_FOLDER = os.path.join(sys.path[0])
-ANIM_BLEND_FOLDER = os.path.join(sys.path[0], 'anim')
+ANIM_BLEND_FILE_FOLDER = os.path.join(sys.path[0], 'anim')
 GOOD_FOLDER = os.path.join(sys.path[0], 'render')
 ANIM_GOOD_FOLDER = os.path.join(sys.path[0], 'anim')
 OUTPUT_FOLDER = os.path.join(sys.path[0], 'output')
@@ -294,11 +294,13 @@
 
     def setup_test(self):
         ''''''
-        if self.test_image != None:
-
+        if self.test_image != None and len(self.good_animation) == len(self.test_animation):
+            
+            i = 0
             for diff_image in self.good_animation:
-                im = ImageChops.difference(self.good_image, self.test_image)
+                im = ImageChops.difference(self.good_animation[i], self.test_animation[i])
                 self.diff_animation.append(im)
+                i+=1
 #            self.diff_hash = self.generate_hash(self.good_animation)
             self.diff_image = self.diff_animation[0]
 
@@ -348,13 +350,6 @@
                 i+=1
             self.diff_path = self.diff_path_arr[0]
 
-def get_cases(blend_file_folder, good_folder, output_folder):
-    '''Returns all of the blend files in the folder'''
-    cases = []
-    cases+=get_image_cases(folder, good_folder, output_folder)
-    cases+=get_animation_cases(os.path.join(blend_file_folder, 'anim'), os.path.join(blend_file_folder, 'anim'), output_folder)
-    return cases
-
 def get_image_cases(blend_file_folder, good_folder, output_folder):
     '''Returns all of the image blend files in the folder'''
     cases = []
@@ -371,7 +366,7 @@
 def get_animation_cases(blend_file_folder, good_folder, output_folder):
     '''Returns all of the animation blend files in the folder'''
     cases = []
-    for filename in os.listdir(folder):
+    for filename in os.listdir(blend_file_folder):
         if filename.find('.blend') != -1:
             blend_path = os.path.join(blend_file_folder, filename)
             good_path = os.path.join(good_folder, string.replace(filename, '.blend', ''))
@@ -381,6 +376,13 @@
             cases.append(test_case)
     return cases
 
+def get_cases(blend_file_folder, good_folder, output_folder):
+    '''Returns all of the blend files in the folder'''
+    cases = []
+    cases+=get_image_cases(blend_file_folder, good_folder, output_folder)
+    cases+=get_animation_cases(os.path.join(blend_file_folder, 'anim'), os.path.join(blend_file_folder, 'anim'), output_folder)
+    return cases
+
 def get_hashcodes(filename):
     file = open(filename, 'r')
 
@@ -700,7 +702,8 @@
         cases.sort(key=lambda case: case.name)
 
     if RUN_IMAGES_AND_ANIMATIONS:
-        cases = get_cases(sys.path[0])
+        cases = get_image_cases(BLEND_FILE_FOLDER, GOOD_FOLDER, OUTPUT_FOLDER)
+        cases += get_animation_cases(ANIM_BLEND_FILE_FOLDER, ANIM_GOOD_FOLDER, ANIM_OUTPUT_FOLDER)
         cases.sort(key=lambda case: case.name)
 
     # Run cases





More information about the Bf-blender-cvs mailing list