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
path: root/tests
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-11-11 16:54:26 +0300
committerBastien Montagne <bastien@blender.org>2021-11-11 16:54:26 +0300
commit06a74e78169ff60082716c0bd85c0b76de6bb885 (patch)
tree7d9a0830be8ed512b400b304aeaf8e0b4578cb37 /tests
parent9f31b9b7d323af4ddeb3199afacd464fe7d9d696 (diff)
LibLink/Append tests: Add basic testing of `bpy.data.libraries.load` code.
Diffstat (limited to 'tests')
-rw-r--r--tests/python/bl_blendfile_liblink.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/python/bl_blendfile_liblink.py b/tests/python/bl_blendfile_liblink.py
index 760a1a15959..f7bd2308061 100644
--- a/tests/python/bl_blendfile_liblink.py
+++ b/tests/python/bl_blendfile_liblink.py
@@ -435,12 +435,45 @@ class TestBlendLibLibraryRelocate(TestBlendLibLinkHelper):
assert(orig_data == relocate_data)
+class TestBlendLibDataLibrariesLoad(TestBlendLibLinkHelper):
+
+ def __init__(self, args):
+ self.args = args
+
+ def test_link_relocate(self):
+ output_dir = self.args.output_dir
+ output_lib_path = self.init_lib_data_basic()
+
+ # Simple link of a single Object, and reload.
+ self.reset_blender()
+
+ with bpy.data.libraries.load(filepath=output_lib_path) as lib_ctx:
+ lib_src, lib_link = lib_ctx
+
+ assert(len(lib_src.meshes) == 1)
+ assert(len(lib_src.objects) == 1)
+ assert(len(lib_src.collections) == 1)
+
+ assert(len(lib_link.meshes) == 0)
+ assert(len(lib_link.objects) == 0)
+ assert(len(lib_link.collections) == 0)
+
+ lib_link.collections.append(lib_src.collections[0])
+
+ # Linking happens when living the context manager.
+
+ assert(len(bpy.data.meshes) == 1)
+ assert(len(bpy.data.objects) == 1) # This code does no instantiation.
+ assert(len(bpy.data.collections) == 1)
+
+
TESTS = (
TestBlendLibLinkSaveLoadBasic,
TestBlendLibAppendBasic,
TestBlendLibAppendReuseID,
TestBlendLibLibraryReload,
TestBlendLibLibraryRelocate,
+ TestBlendLibDataLibrariesLoad,
)