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

Leif Andersen leif.a.andersen at gmail.com
Thu Jun 24 19:34:37 CEST 2010


Revision: 29671
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29671
Author:   leifandersen
Date:     2010-06-24 19:34:36 +0200 (Thu, 24 Jun 2010)

Log Message:
-----------
1.  Some more tests on the Blender UI.  Unfortunetly, you can only append things to the list of items rather than inserting it somewhere, so the tests menu is in a horrid place (UI speaking).  It is possible though to insert it in the header method itself, but I'm going to hold off on that for the moment.

2.  Initial work on turning the render comparison test into a C based operator.  It is set up to be registored, but I still need to make a ED_operatortypes_tests method, link it properly, etc.etc.  I'll be putting that down for the moment though, until I can get a perceptual image diff in C to work.   Also, it may be possible to set it up to use these libraries from the Python/C API, leaving the tests to still be built in python.

Modified Paths:
--------------
    branches/soc-2010-leifandersen/source/blender/editors/CMakeLists.txt

Added Paths:
-----------
    branches/soc-2010-leifandersen/source/blender/editors/include/ED_tests.h
    branches/soc-2010-leifandersen/source/blender/editors/tests/
    branches/soc-2010-leifandersen/source/blender/editors/tests/CMakeLists.txt
    branches/soc-2010-leifandersen/source/blender/editors/tests/tests_intern.h
    branches/soc-2010-leifandersen/source/blender/editors/tests/tests_ops.c
    branches/soc-2010-leifandersen/source/blender/editors/tests/tests_render.c
    branches/soc-2010-leifandersen/tests/properties_tests.py
    branches/soc-2010-leifandersen/tests/properties_tests.py.elube

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

Modified: branches/soc-2010-leifandersen/source/blender/editors/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/source/blender/editors/CMakeLists.txt	2010-06-24 15:54:01 UTC (rev 29670)
+++ branches/soc-2010-leifandersen/source/blender/editors/CMakeLists.txt	2010-06-24 17:34:36 UTC (rev 29671)
@@ -52,6 +52,7 @@
 ADD_SUBDIRECTORY(space_time)
 ADD_SUBDIRECTORY(space_userpref)
 ADD_SUBDIRECTORY(space_view3d)
+ADD_SUBDIRECTORY(tests)
 ADD_SUBDIRECTORY(transform)
 ADD_SUBDIRECTORY(util)
 ADD_SUBDIRECTORY(uvedit)

Added: branches/soc-2010-leifandersen/source/blender/editors/include/ED_tests.h
===================================================================

Added: branches/soc-2010-leifandersen/source/blender/editors/tests/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/source/blender/editors/tests/CMakeLists.txt	                        (rev 0)
+++ branches/soc-2010-leifandersen/source/blender/editors/tests/CMakeLists.txt	2010-06-24 17:34:36 UTC (rev 29671)
@@ -0,0 +1,13 @@
+FILE(GLOB SRC *.c)
+
+SET(INC
+	../include
+	../../blenkernel
+	../../blenlib
+	../../../../intern/guardedalloc
+	../../makesdna
+	../../makesrna
+	../../windowmanager
+)
+
+BLENDERLIB(bf_editor_tests "${SRC}" "${INC}")

Added: branches/soc-2010-leifandersen/source/blender/editors/tests/tests_intern.h
===================================================================
--- branches/soc-2010-leifandersen/source/blender/editors/tests/tests_intern.h	                        (rev 0)
+++ branches/soc-2010-leifandersen/source/blender/editors/tests/tests_intern.h	2010-06-24 17:34:36 UTC (rev 29671)
@@ -0,0 +1,13 @@
+#ifndef _TESTS_H_
+#define _TESTS_H_
+
+struct wmOperatorType;
+struct bContext;
+struct wmWindowManager;
+
+/*tests_ops.c*/
+void view3d_operatortypes(void);
+		
+/*tests_render.c*/
+void TESTS_OT_render(struct wmOperatorType *ot);
+#endif

Added: branches/soc-2010-leifandersen/source/blender/editors/tests/tests_ops.c
===================================================================
--- branches/soc-2010-leifandersen/source/blender/editors/tests/tests_ops.c	                        (rev 0)
+++ branches/soc-2010-leifandersen/source/blender/editors/tests/tests_ops.c	2010-06-24 17:34:36 UTC (rev 29671)
@@ -0,0 +1,11 @@
+#include <stdlib.h>
+
+#include "tests_intern.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+void tests_operatortypes(void)
+{
+	WM_operatortype_append(TESTS_OT_render);
+}

Added: branches/soc-2010-leifandersen/source/blender/editors/tests/tests_render.c
===================================================================
--- branches/soc-2010-leifandersen/source/blender/editors/tests/tests_render.c	                        (rev 0)
+++ branches/soc-2010-leifandersen/source/blender/editors/tests/tests_render.c	2010-06-24 17:34:36 UTC (rev 29671)
@@ -0,0 +1,42 @@
+#include "tests_intern.h"
+
+#include <stdlib.h>
+
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
+#include "BLI_threads.h"
+#include "BLI_rand.h"
+
+#include "BKE_blender.h"
+#include "BKE_colortools.h"
+#include "BKE_context.h"
+#include "BKE_global.h"
+#include "BKE_image.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_multires.h"
+#include "BKE_report.h"
+#include "BKE_screen.h"
+#include "BKE_utildefines.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "wm_window.h"
+
+static int render_compare(bContext* C) {
+	return OPERATOR_FINISHED;
+}
+
+void TESTS_OT_render(wmOperatorType *ot) {
+	ot->name = "Image Diff Test";
+	ot->description = "Tests for any perceptual difference in two images";
+	ot->idname = "TESTS_OT_render";
+	
+	ot->exec = render_compare;
+	
+	ot->poll = 1;
+}

Deleted: branches/soc-2010-leifandersen/tests/properties_tests.py
===================================================================
--- branches/soc-2010-leifandersen/tests/properties_tests.py	2010-06-24 15:54:01 UTC (rev 29670)
+++ branches/soc-2010-leifandersen/tests/properties_tests.py	2010-06-24 17:34:36 UTC (rev 29671)
@@ -1,58 +0,0 @@
-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()

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-24 17:34:36 UTC (rev 29671)
@@ -0,0 +1,46 @@
+import bpy
+
+class TESTS_OT_render(bpy.types.Operator):
+    ''''''
+    bl_idname = "TESTS_OT_render"
+    bl_label = "Render Tests"
+
+    def execute(self, context):
+        pass
+
+
+class INFO_MT_tests(bpy.types.Menu):
+    ''''''
+    bl_idname = "INFO_MT_tests"
+    bl_label = "Tests"
+
+    def draw(self, context):
+        layout = self.layout
+#        layout.operator_context = 'EXEC_AREA'
+        layout.operator_context = 'INVOKE_AREA'
+        layout.operator("TESTS_OT_render", text="Run All...")
+        layout.separator()
+        layout.operator("RENDER_OT_render", text="Render")
+        layout.separator()
+
+
+classes = [
+    TESTS_OT_RENDER,
+    INFO_MT_tests,
+]
+
+menu_func = (lambda self, context: self.layout.menu("INFO_MT_tests"))
+
+
+def register():
+    for i in classes:
+        bpy.types.register(i)
+    bpy.types.INFO_HT_header.append(menu_func)
+#    bpy.types.INFO_MT_help.append(menu_func)
+
+def unregister():
+    for i in classes:
+        bpy.types.unregister(i)
+
+if __name__ == "__main__":
+    register()
\ No newline at end of file

Copied: branches/soc-2010-leifandersen/tests/properties_tests.py.elube (from rev 29629, branches/soc-2010-leifandersen/tests/properties_tests.py)
===================================================================
--- branches/soc-2010-leifandersen/tests/properties_tests.py.elube	                        (rev 0)
+++ branches/soc-2010-leifandersen/tests/properties_tests.py.elube	2010-06-24 17:34:36 UTC (rev 29671)
@@ -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