[Bf-blender-cvs] [c8978b1] render-layers: unittest: syncing when unlinking a collection

Dalai Felinto noreply at git.blender.org
Wed Dec 21 19:15:07 CET 2016


Commit: c8978b160df32dcf6a37c89ba96441278aa9d2a7
Author: Dalai Felinto
Date:   Wed Dec 21 18:11:23 2016 +0100
Branches: render-layers
https://developer.blender.org/rBc8978b160df32dcf6a37c89ba96441278aa9d2a7

unittest: syncing when unlinking a collection

===================================================================

M	tests/python/bl_render_layer.py

===================================================================

diff --git a/tests/python/bl_render_layer.py b/tests/python/bl_render_layer.py
index 476dd62..0d7919d 100644
--- a/tests/python/bl_render_layer.py
+++ b/tests/python/bl_render_layer.py
@@ -429,7 +429,7 @@ class UnitsTesting(unittest.TestCase):
                 'LINK_OBJECTS',
                 (get_scene_collections, get_layers))
 
-    def do_syncing(self, filepath_json, do_unlink):
+    def do_syncing(self, filepath_json, unlink_mode):
         import bpy
         import os
         import tempfile
@@ -456,11 +456,16 @@ class UnitsTesting(unittest.TestCase):
             subzero.objects.link(three_b)
             scorpion.objects.link(three_c)
 
-            if do_unlink:
-                # test unlinking sync
+            # test unlinking sync
+            if unlink_mode in {'OBJECT', 'COLLECTION'}:
                 scorpion.objects.link(three_d)
                 scorpion.objects.unlink(three_d)
 
+            if unlink_mode == 'COLLECTION':
+                scorpion.objects.link(three_d)
+                scene.master_collection.collections['1'].collections.remove(subzero)
+                scene.master_collection.collections['1'].collections.remove(scorpion)
+
             # save file
             filepath_nested = os.path.join(dirpath, 'nested.blend')
             bpy.ops.wm.save_mainfile('EXEC_DEFAULT', filepath=filepath_nested)
@@ -488,9 +493,9 @@ class UnitsTesting(unittest.TestCase):
         import os
         ROOT = self.get_root()
         filepath_json = os.path.join(ROOT, 'layers_nested.json')
-        self.do_syncing(filepath_json, False)
+        self.do_syncing(filepath_json, 'NONE')
 
-    def test_syncing_unlink(self):
+    def test_syncing_unlink_object(self):
         """
         See if scene collections and layer collections are in sync
         when we create new subcollections, link new objects and unlink
@@ -499,7 +504,18 @@ class UnitsTesting(unittest.TestCase):
         import os
         ROOT = self.get_root()
         filepath_json = os.path.join(ROOT, 'layers_nested.json')
-        self.do_syncing(filepath_json, True)
+        self.do_syncing(filepath_json, 'OBJECT')
+
+    def test_syncing_unlink_collection(self):
+        """
+        See if scene collections and layer collections are in sync
+        when we create new subcollections, link new objects and unlink full collections
+        some.
+        """
+        import os
+        ROOT = self.get_root()
+        filepath_json = os.path.join(ROOT, 'layers.json')
+        self.do_syncing(filepath_json, 'COLLECTION')
 
 
 # ############################################################




More information about the Bf-blender-cvs mailing list