Revision: 30674 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30674 Author: leifandersen Date: 2010-07-23 22:17:43 +0200 (Fri, 23 Jul 2010)
Log Message: ----------- Feedback is now given in the GUI, showing the hashcode of the file (based on the last time run), and whether or not the tests have been run (Although not on what file, or if it passed, yet). I'm just using the tests module as a context to pass parameters. It is a bit of a hack, but it is also much quicker than modifying the current context to store that (and I'm not aware of any other ways to get return values other than passed/failed/passed through/etc. out of operators). Modified Paths: -------------- branches/soc-2010-leifandersen/release/scripts/modules/tests/__init__.py branches/soc-2010-leifandersen/release/scripts/modules/tests/hashfile.py branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py branches/soc-2010-leifandersen/release/scripts/op/tests_render.py branches/soc-2010-leifandersen/release/scripts/ui/space_tests.py Added Paths: ----------- branches/soc-2010-leifandersen/release/scripts/modules/tests/render.py Modified: branches/soc-2010-leifandersen/release/scripts/modules/tests/__init__.py =================================================================== --- branches/soc-2010-leifandersen/release/scripts/modules/tests/__init__.py 2010-07-23 20:06:59 UTC (rev 30673) +++ branches/soc-2010-leifandersen/release/scripts/modules/tests/__init__.py 2010-07-23 20:17:43 UTC (rev 30674) @@ -16,4 +16,4 @@ # # ##### END GPL LICENSE BLOCK ##### -from tests import scenes, objects, meshes, lamps, hashfile, build +from tests import scenes, objects, meshes, lamps, hashfile, build, render Modified: branches/soc-2010-leifandersen/release/scripts/modules/tests/hashfile.py =================================================================== --- branches/soc-2010-leifandersen/release/scripts/modules/tests/hashfile.py 2010-07-23 20:06:59 UTC (rev 30673) +++ branches/soc-2010-leifandersen/release/scripts/modules/tests/hashfile.py 2010-07-23 20:17:43 UTC (rev 30674) @@ -66,3 +66,5 @@ change_index = hash_locations[number-1] data[change_index][1] = hashcode tests.hashfile.write(path, data) + +last_hash = -1 \ No newline at end of file Added: branches/soc-2010-leifandersen/release/scripts/modules/tests/render.py =================================================================== --- branches/soc-2010-leifandersen/release/scripts/modules/tests/render.py (rev 0) +++ branches/soc-2010-leifandersen/release/scripts/modules/tests/render.py 2010-07-23 20:17:43 UTC (rev 30674) @@ -0,0 +1,19 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +status = "Not Run" \ No newline at end of file Modified: branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py =================================================================== --- branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py 2010-07-23 20:06:59 UTC (rev 30673) +++ branches/soc-2010-leifandersen/release/scripts/op/tests_hash.py 2010-07-23 20:17:43 UTC (rev 30674) @@ -1,4 +1,6 @@ import bpy +import tests + from bpy.props import * @@ -49,9 +51,9 @@ hashcode += hash(num) for hair in particles.hair: for num in hair.location: - hashcode += hash(num) - + hashcode += hash(num) print(hashcode) + tests.hashfile.last_hash = hashcode return {'FINISHED'} # def invoke(self, context, event): Modified: branches/soc-2010-leifandersen/release/scripts/op/tests_render.py =================================================================== --- branches/soc-2010-leifandersen/release/scripts/op/tests_render.py 2010-07-23 20:06:59 UTC (rev 30673) +++ branches/soc-2010-leifandersen/release/scripts/op/tests_render.py 2010-07-23 20:17:43 UTC (rev 30674) @@ -1,5 +1,7 @@ import os import sys +import tests + import bpy from bpy.props import * @@ -30,6 +32,7 @@ (directory, filename) = os.path.split(self.properties.filepath) command = PYTHON_BIN + " " + IMAGEDIFF_PY + " --image " + self.properties.filepath + " --blender-bin " + BLENDER_BIN print(os.system(command)) + tests.render.status = "Run" return {'FINISHED'} def invoke(self, context, event): @@ -47,6 +50,8 @@ filepath = StringProperty(name="File Path", description="Filepath used", maxlen= 1024, default= "") directory = StringProperty(name="File Directory", description="File Directory used", maxlen= 1024, default= "") + test_passed = True + def poll(self, context): return True @@ -55,6 +60,8 @@ for file in os.listdir(directory): if file.find('.blend') != -1: bpy.ops.tests.render(filepath=self.properties.filepath) + if test_passed and tests.render.status == "Not Run": + tests_passed = False return {'FINISHED'} def invoke(self, context,event): @@ -78,6 +85,7 @@ (directory, filename) = os.path.split(self.properties.filepath) command = PYTHON_BIN + " " + IMAGEDIFF_PY + " --animation " + self.properties.filepath + " --blender-bin " + BLENDER_BIN print(os.system(command)) + tests.render.status = "Run" return {'FINISHED'} def invoke(self, context, event): Modified: branches/soc-2010-leifandersen/release/scripts/ui/space_tests.py =================================================================== --- branches/soc-2010-leifandersen/release/scripts/ui/space_tests.py 2010-07-23 20:06:59 UTC (rev 30673) +++ branches/soc-2010-leifandersen/release/scripts/ui/space_tests.py 2010-07-23 20:17:43 UTC (rev 30674) @@ -1,4 +1,5 @@ import bpy +import tests class INFO_MT_tests(bpy.types.Menu): '''''' @@ -25,7 +26,7 @@ layout = self.layout row = layout.row() # row.operator_context = 'INVOKE_REGION_WIN' - row.label(text="Blend hashcode: " + str(-1)) + row.label(text="Blend hashcode: " + str(tests.hashfile.last_hash)) row = layout.row() row.operator('TESTS_OT_hash', text = "Get Hash") layout.separator() @@ -40,7 +41,7 @@ row = layout.row() row.operator("RENDER_OT_render", text="Render") row = layout.row() - row.label(text="Status: " + "Not Run") + row.label(text="Status: " + tests.render.status) classes = [ INFO_MT_tests, _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs