[Bf-blender-cvs] [641456cb3e0] temp-group-collections: Initial group unittests

Dalai Felinto noreply at git.blender.org
Wed Nov 1 18:14:40 CET 2017


Commit: 641456cb3e0220ee8ed99e1e3dd0d8ed6fc09fd3
Author: Dalai Felinto
Date:   Fri Oct 27 17:34:30 2017 -0200
Branches: temp-group-collections
https://developer.blender.org/rB641456cb3e0220ee8ed99e1e3dd0d8ed6fc09fd3

Initial group unittests

See if creating groups is working, and if it has the same structure and values
of original collection.

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

M	tests/python/render_layer/CMakeLists.txt
A	tests/python/render_layer/test_group_a.py
A	tests/python/render_layer/test_group_b.py

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

diff --git a/tests/python/render_layer/CMakeLists.txt b/tests/python/render_layer/CMakeLists.txt
index 5ff985073e3..305a1c93b58 100644
--- a/tests/python/render_layer/CMakeLists.txt
+++ b/tests/python/render_layer/CMakeLists.txt
@@ -86,6 +86,8 @@ RENDER_LAYER_TEST(evaluation_selectability_c)
 RENDER_LAYER_TEST(evaluation_selectability_d)
 RENDER_LAYER_TEST(evaluation_selectability_e)
 RENDER_LAYER_TEST(evaluation_selectability_f)
+RENDER_LAYER_TEST(group_a)
+RENDER_LAYER_TEST(group_b)
 RENDER_LAYER_TEST(object_add_cylinder)
 RENDER_LAYER_TEST(object_add_empty)
 RENDER_LAYER_TEST(object_add_torus)
diff --git a/tests/python/render_layer/test_group_a.py b/tests/python/render_layer/test_group_a.py
new file mode 100644
index 00000000000..90ef715e789
--- /dev/null
+++ b/tests/python/render_layer/test_group_a.py
@@ -0,0 +1,38 @@
+# ############################################################
+# Importing - Same For All Render Layer Tests
+# ############################################################
+
+import unittest
+import os
+import sys
+
+from render_layer_common import *
+
+
+# ############################################################
+# Testing
+# ############################################################
+
+class UnitTesting(RenderLayerTesting):
+    def test_group_create_basic(self):
+        """
+        See if the creation of new groups is working
+        """
+        import bpy
+        scene = bpy.context.scene
+        layer_collection = bpy.context.layer_collection
+
+        # create group
+        group = layer_collection.create_group()
+
+        # update depsgraph
+        scene.update()
+
+
+# ############################################################
+# Main - Same For All Render Layer Tests
+# ############################################################
+
+if __name__ == '__main__':
+    UnitTesting._extra_arguments = setup_extra_arguments(__file__)
+    unittest.main()
diff --git a/tests/python/render_layer/test_group_b.py b/tests/python/render_layer/test_group_b.py
new file mode 100644
index 00000000000..4df21aac2ea
--- /dev/null
+++ b/tests/python/render_layer/test_group_b.py
@@ -0,0 +1,72 @@
+# ############################################################
+# Importing - Same For All Render Layer Tests
+# ############################################################
+
+import unittest
+import os
+import sys
+
+from render_layer_common import *
+
+
+# ############################################################
+# Testing
+# ############################################################
+
+class UnitTesting(RenderLayerTesting):
+
+    def test_group_create_basic(self):
+        """
+        See if the creation of new groups is working
+        """
+        import bpy
+        scene = bpy.context.scene
+
+        # clean slate
+        self.cleanup_tree()
+
+        master_collection = scene.master_collection
+        grandma = master_collection.collections.new('бабушка')
+        mom = grandma.collections.new('матушка')
+
+        child = bpy.data.objects.new("Child", None)
+        mom.objects.link(child)
+
+        grandma_layer_collection = scene.render_layers[0].collections.link(grandma)
+        mom_layer_collection = grandma_layer_collection.collections[0]
+
+        grandma_layer_collection.hide = False
+        grandma_layer_collection.hide = False
+        mom_layer_collection.hide = True
+        mom_layer_collection.hide_select = False
+
+        # update depsgraph
+        scene.update()
+
+        # create group
+        group = grandma_layer_collection.create_group()
+
+        # update depsgraph
+        scene.update()
+
+        # compare
+        self.assertEqual(len(group.collections), 1)
+        grandma_group_layer = group.collections[0]
+
+        self.assertEqual(grandma_group_layer.hide, False)
+        self.assertEqual(grandma_group_layer.hide_select, False)
+
+        self.assertEqual(len(grandma_group_layer.collections), 1)
+        mom_group_layer = grandma_group_layer.collections[0]
+
+        self.assertEqual(mom_group_layer.hide, True)
+        self.assertEqual(mom_group_layer.hide_select, False)
+
+
+# ############################################################
+# Main - Same For All Render Layer Tests
+# ############################################################
+
+if __name__ == '__main__':
+    UnitTesting._extra_arguments = setup_extra_arguments(__file__)
+    unittest.main()



More information about the Bf-blender-cvs mailing list