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:
authorSybren A. Stüvel <sybren@blender.org>2020-02-25 18:46:37 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-02-25 19:22:23 +0300
commit65aa55babc57232c83cf14b7e74ecefa2c4ac3ba (patch)
tree796a446a9fba4cebc72ca0299373c64165ee2aca
parent280d2a9a17aeef56a590ab18ee150142b4fadfcd (diff)
Tests: Constraints, enable layer collections before testing
In the collections unit test file developers can now disable layer collections and declutter the 3D Viewport while working in `constraints.blend`, without influencing the actual unit tests themselves.
-rw-r--r--tests/python/bl_constraints.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/python/bl_constraints.py b/tests/python/bl_constraints.py
index 2a48ffe35ea..21e3fad3be8 100644
--- a/tests/python/bl_constraints.py
+++ b/tests/python/bl_constraints.py
@@ -31,9 +31,19 @@ from mathutils import Matrix
class AbstractConstraintTests(unittest.TestCase):
"""Useful functionality for constraint tests."""
+ layer_collection = '' # When set, this layer collection will be enabled.
+
def setUp(self):
bpy.ops.wm.open_mainfile(filepath=str(args.testdir / "constraints.blend"))
+ # This allows developers to disable layer collections and declutter the
+ # 3D Viewport while working in constraints.blend, without influencing
+ # the actual unit tests themselves.
+ if self.layer_collection:
+ top_collection = bpy.context.view_layer.layer_collection
+ collection = top_collection.children[self.layer_collection]
+ collection.exclude = False
+
def assert_matrix(self, actual_matrix, expect_matrix, object_name: str, places=6, delta=None):
"""Asserts that the matrices almost equal."""
self.assertEqual(len(actual_matrix), 4, 'Expected a 4x4 matrix')
@@ -76,6 +86,8 @@ class AbstractConstraintTests(unittest.TestCase):
class ChildOfTest(AbstractConstraintTests):
+ layer_collection = 'Child Of'
+
def test_object_simple_parent(self):
"""Child Of: simple evaluation of object parent."""
initial_matrix = Matrix((