Revision: 29410
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29410
Author:   leifandersen
Date:     2010-06-11 19:14:41 +0200 (Fri, 11 Jun 2010)

Log Message:
-----------
Added a test, and the start for a fix of bug #22557, although it's probably too 
much of a hack, and has bad side efffects, also, it still crashes when using it 
in -b -P (bg mode?).

Modified Paths:
--------------
    
branches/soc-2010-leifandersen/source/blender/windowmanager/intern/wm_event_system.c
    branches/soc-2010-leifandersen/tests/pyunit/ops/CMakeLists.txt
    branches/soc-2010-leifandersen/tests/pyunit/ops/particle.py

Added Paths:
-----------
    branches/soc-2010-leifandersen/tests/pyunit/ops/pawns.blend
    branches/soc-2010-leifandersen/tests/pyunit/ops/setup.py

Modified: 
branches/soc-2010-leifandersen/source/blender/windowmanager/intern/wm_event_system.c
===================================================================
--- 
branches/soc-2010-leifandersen/source/blender/windowmanager/intern/wm_event_system.c
        2010-06-11 15:35:11 UTC (rev 29409)
+++ 
branches/soc-2010-leifandersen/source/blender/windowmanager/intern/wm_event_system.c
        2010-06-11 17:14:41 UTC (rev 29410)
@@ -1648,7 +1648,7 @@
                                }
 
                                for(sa= win->screen->areabase.first; sa; sa= 
sa->next) {
-                                       if(wm_event_inside_i(event, 
&sa->totrct)) {
+                                       if(&sa->totrct != NULL && 
wm_event_inside_i(event, &sa->totrct)) {
                                                CTX_wm_area_set(C, sa);
 
                                                if((action & WM_HANDLER_BREAK) 
== 0) {
@@ -1725,16 +1725,19 @@
                                        win->eventstate->prevval = event->val;
                                        win->eventstate->prevclicktime = 
PIL_check_seconds_timer();
                                } else { /* reset if not */
-                                       win->eventstate->prevtype = -1;
-                                       win->eventstate->prevval = 0;
-                                       win->eventstate->prevclicktime = 0;
+                                       if(win->eventstate) {
+                                               win->eventstate->prevtype = -1;
+                                               win->eventstate->prevval = 0;
+                                               win->eventstate->prevclicktime 
= 0;
+                                       }
                                }
                        }
-
-                       /* unlink and free here, blender-quit then frees all */
-                       BLI_remlink(&win->queue, event);
-                       wm_event_free(event);
                        
+                       if(win->eventstate) {
+                               /* unlink and free here, blender-quit then 
frees all */
+                               BLI_remlink(&win->queue, event);
+                               wm_event_free(event);
+                       }
                }
                
                /* only add mousemove when queue was read entirely */

Modified: branches/soc-2010-leifandersen/tests/pyunit/ops/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/CMakeLists.txt      
2010-06-11 15:35:11 UTC (rev 29409)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/CMakeLists.txt      
2010-06-11 17:14:41 UTC (rev 29410)
@@ -1,2 +1,5 @@
 ADD_TEST(Ops_Particle_Test ${Blender_BINARY_DIR}/bin/blender -b -P 
${Blender_BINARY_DIR}/tests/pyunit/ops/particle.py)
 SET_TESTS_PROPERTIES(Ops_Particle_Test PROPERTIES PASS_REGULAR_EXPRESSION "OK")
+
+ADD_TEST(Ops_Setup_Test ${Blender_BINARY_DIR}/bin/blender -b -P 
${Blender_BINARY_DIR}/tests/pyunit/ops/setup.py)
+SET_TESTS_PROPERTIES(Ops_Setup_Test PROPERTIES PASS_REGULAR_EXPRESSION "OK")

Modified: branches/soc-2010-leifandersen/tests/pyunit/ops/particle.py
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/particle.py 2010-06-11 
15:35:11 UTC (rev 29409)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/particle.py 2010-06-11 
17:14:41 UTC (rev 29410)
@@ -8,13 +8,12 @@
         tests.scenes.reset_scenes()
         tests.build.mesh.cube("Cube")
         cube = bpy.data.objects['Cube']
-        bpy.data.scenes[0].objects.link(cube)
-        bpy.context.scene.objects.active = cube
-        cube.selected = True
-        bpy.ops.object.particle_system_add()
+        bpy.ops.object.particle_system_add({"object":cube})
 
+
     def test_particle_generation(self):
-        pass
+        part = bpy.data.particles[0]
+        part.type = 'HAIR'
 
 def suite():
     return unittest.TestSuite([

Added: branches/soc-2010-leifandersen/tests/pyunit/ops/pawns.blend
===================================================================
(Binary files differ)


Property changes on: branches/soc-2010-leifandersen/tests/pyunit/ops/pawns.blend
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Copied: branches/soc-2010-leifandersen/tests/pyunit/ops/setup.py (from rev 
29330, branches/soc-2010-leifandersen/tests/pyunit/ops/particle.py)
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/setup.py                    
        (rev 0)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/setup.py    2010-06-11 
17:14:41 UTC (rev 29410)
@@ -0,0 +1,31 @@
+import bpy
+import tests
+import unittest
+
+class TestSetUp(unittest.TestCase):
+
+    # No setUp required for this test, as we'll be testing the various setUp 
methods here
+    def setUp(self):
+        pass
+
+
+    def test_factory_default(self):
+        bpy.ops.wm.read_homefile(factory=True)
+
+    def test_users_default(self):
+        bpy.ops.wm.read_homefile(factory=False)
+
+    def test_no_params(self):
+        bpy.ops.wm.read_homefile()
+
+    # Not sure what paramaters are apropriate here, as nothing has yet worked 
in the console either...
+    def test_load_empty_scene(self):
+        bpy.ops.wm.open_mainfile(filename="pawns.blend")
+
+def suite():
+    return unittest.TestSuite([
+unittest.TestLoader().loadTestsFromTestCase(TestSetUp),
+])
+
+if __name__ == "__main__":
+    unittest.TextTestRunner(verbosity=2).run(suite())


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to