Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-01-19 23:44:11 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-01-19 23:44:11 +0300
commite969ac64137e53c0a375886d5e175f1e6b05073a (patch)
treec779ce2fa7daa00816fc1038c479a8a0d67b3b70 /tests/python/view_layer
parent4dfccf8b7f2dfea787d7155b9c531cf56c1b33ae (diff)
Fix collections names no longer unique when moved around
We were not checking for uniqueness after moving. And in some cases the new siblings of our collection may have conflicting names.
Diffstat (limited to 'tests/python/view_layer')
-rw-r--r--tests/python/view_layer/CMakeLists.txt3
-rw-r--r--tests/python/view_layer/test_collection_rename_a.py (renamed from tests/python/view_layer/test_collection_rename.py)0
-rw-r--r--tests/python/view_layer/test_collection_rename_b.py58
3 files changed, 60 insertions, 1 deletions
diff --git a/tests/python/view_layer/CMakeLists.txt b/tests/python/view_layer/CMakeLists.txt
index 69b02416487..e308e2e0952 100644
--- a/tests/python/view_layer/CMakeLists.txt
+++ b/tests/python/view_layer/CMakeLists.txt
@@ -62,7 +62,8 @@ endmacro()
VIEW_LAYER_TEST(active_collection)
VIEW_LAYER_TEST(background_set)
-VIEW_LAYER_TEST(collection_rename)
+VIEW_LAYER_TEST(collection_rename_a)
+VIEW_LAYER_TEST(collection_rename_b)
VIEW_LAYER_TEST(evaluation_render_settings_a)
VIEW_LAYER_TEST(evaluation_render_settings_b)
VIEW_LAYER_TEST(evaluation_render_settings_c)
diff --git a/tests/python/view_layer/test_collection_rename.py b/tests/python/view_layer/test_collection_rename_a.py
index ea156d7346f..ea156d7346f 100644
--- a/tests/python/view_layer/test_collection_rename.py
+++ b/tests/python/view_layer/test_collection_rename_a.py
diff --git a/tests/python/view_layer/test_collection_rename_b.py b/tests/python/view_layer/test_collection_rename_b.py
new file mode 100644
index 00000000000..3787066e1b9
--- /dev/null
+++ b/tests/python/view_layer/test_collection_rename_b.py
@@ -0,0 +1,58 @@
+# ############################################################
+# Importing - Same For All Render Layer Tests
+# ############################################################
+
+import unittest
+import os
+import sys
+
+from view_layer_common import *
+
+
+# ############################################################
+# Testing
+# ############################################################
+
+class UnitTesting(ViewLayerTesting):
+ def setup_collections(self):
+ import bpy
+ scene = bpy.context.scene
+
+ master = scene.master_collection
+ one = master.collections[0]
+ two = master.collections.new()
+ sub = two.collections.new(one.name)
+
+ self.assertEqual(one.name, sub.name)
+
+ lookup = {
+ 'master': master,
+ 'one': one,
+ 'two': two,
+ 'sub': sub,
+ }
+ return lookup
+
+ def test_move_above(self):
+ collections = self.setup_collections()
+ collections['sub'].move_above(collections['one'])
+ self.assertNotEqual(collections['one'].name, collections['sub'].name)
+
+ def test_move_below(self):
+ collections = self.setup_collections()
+ collections['sub'].move_below(collections['one'])
+ self.assertNotEqual(collections['one'].name, collections['sub'].name)
+
+ def test_move_into(self):
+ collections = self.setup_collections()
+ collections['sub'].move_into(collections['master'])
+ self.assertNotEqual(collections['one'].name, collections['sub'].name)
+
+
+# ############################################################
+# Main - Same For All Render Layer Tests
+# ############################################################
+
+if __name__ == '__main__':
+ UnitTesting._extra_arguments = setup_extra_arguments(__file__)
+ unittest.main()