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

Leif Andersen leif.a.andersen at gmail.com
Tue Jun 22 22:04:43 CEST 2010


Revision: 29629
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29629
Author:   leifandersen
Date:     2010-06-22 22:04:42 +0200 (Tue, 22 Jun 2010)

Log Message:
-----------
1.  Added Andrea's Menu operator, and sample test that goes with it.

Modified Paths:
--------------
    branches/soc-2010-leifandersen/tests/TestPanel.py

Added Paths:
-----------
    branches/soc-2010-leifandersen/tests/properties_tests.py

Modified: branches/soc-2010-leifandersen/tests/TestPanel.py
===================================================================
--- branches/soc-2010-leifandersen/tests/TestPanel.py	2010-06-22 18:52:34 UTC (rev 29628)
+++ branches/soc-2010-leifandersen/tests/TestPanel.py	2010-06-22 20:04:42 UTC (rev 29629)
@@ -16,6 +16,24 @@
         return {'RUNNING_MODAL'}
 
 
+class hashopener(bpy.types.Operator):
+    bl_idname = "tests.open"
+    bl_label = "Hashfile Opener"
+
+    def poll(self, context):
+        return True
+
+    def execute(self, context):
+        print("Sample")
+        return {'FINISHED'}
+
+    def invoke(self, context, event):
+        wm = context.manager
+        wm.add_fileselect(self)
+        print("Selecting file")
+        return {'RUNNING_MODEL'}
+
+
 class hashpanel(bpy.types.Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'TOOLS'

Added: branches/soc-2010-leifandersen/tests/properties_tests.py
===================================================================
--- branches/soc-2010-leifandersen/tests/properties_tests.py	                        (rev 0)
+++ branches/soc-2010-leifandersen/tests/properties_tests.py	2010-06-22 20:04:42 UTC (rev 29629)
@@ -0,0 +1,58 @@
+import bpy
+import unittest
+ 
+class ModifierTests(unittest.TestCase):
+    def testSubsurf(self):
+        cube = bpy.data.objects['Cube']
+        scene = bpy.context.scene
+        scene.objects.active = cube
+        scene.objects.active.selected = True
+        bpy.ops.object.modifier_add(type='SUBSURF')
+ 
+class ModifierTestOp(bpy.types.Operator):
+    ''''''
+    bl_idname = "object.modifier_tests"
+    bl_label = "Modifier Tests"
+ 
+    def poll(self, context):
+        return True
+ 
+    def execute(self, context):
+        suite = unittest.TestLoader().loadTestsFromTestCase(ModifierTests)
+        unittest.TextTestRunner(verbosity=2).run(suite)
+        return {'FINISHED'}
+ 
+ 
+# Menu for Tests
+class INFO_MT_tests(bpy.types.Menu):
+    bl_label = "Unit Tests"
+ 
+    def draw(self, context):
+        layout = self.layout
+ 
+        layout.operator("object.modifier_tests", text="Modifier Tests")
+ 
+        layout.separator()
+ 
+classes = [
+    ModifierTestOp,
+    INFO_MT_tests]
+ 
+ 
+menu_func = (lambda self, context: self.layout.menu("INFO_MT_tests"))
+   
+def register():
+    print('register')
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+    bpy.types.INFO_MT_help.append(menu_func)
+ 
+ 
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
+ 
+if __name__ == "__main__":
+    register()





More information about the Bf-blender-cvs mailing list