diff options
Diffstat (limited to 'tests/python')
-rw-r--r-- | tests/python/bl_blendfile_liblink.py | 33 |
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, ) |