From 7629182c62e46e7b3e65e7e37e412ad75f9bcdc4 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 8 May 2024 18:49:33 +0200 Subject: [PATCH] Unittests: blendfile versioning: Add Link and Append basic tests. These are really basic testing as well, merely linking or appending the first collection or object in all processed blendfiles. But it should help catching 'rare' issues in linking/appending from older blendfiles. --- tests/python/bl_blendfile_versioning.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/python/bl_blendfile_versioning.py b/tests/python/bl_blendfile_versioning.py index c0b57c3ccfb..9868088f0fd 100644 --- a/tests/python/bl_blendfile_versioning.py +++ b/tests/python/bl_blendfile_versioning.py @@ -79,6 +79,24 @@ class TestBlendFileOpenAllTestFiles(TestHelper): bpy.ops.wm.read_homefile(use_empty=True, use_factory_startup=True) bpy.ops.wm.open_mainfile(filepath=bfp, load_ui=False) + def link_append(self, do_link): + for bfp in self.blendfile_paths: + if os.path.basename(bfp) in self.excluded_paths: + continue + bpy.ops.wm.read_homefile(use_empty=True, use_factory_startup=True) + with bpy.data.libraries.load(bfp, link=do_link) as (lib_in, lib_out): + if len(lib_in.collections): + lib_out.collections.append(lib_in.collections[0]) + elif len(lib_in.objects): + lib_out.objects.append(lib_in.objects[0]) + + + def test_link(self): + self.link_append(do_link=True) + + def test_append(self): + self.link_append(do_link=False) + TESTS = ( TestBlendFileOpenAllTestFiles,