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:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/performance/benchmark16
-rw-r--r--tests/python/bl_blendfile_liblink.py67
2 files changed, 82 insertions, 1 deletions
diff --git a/tests/performance/benchmark b/tests/performance/benchmark
index a58c339e9f8..80556674dcc 100755
--- a/tests/performance/benchmark
+++ b/tests/performance/benchmark
@@ -4,6 +4,7 @@
import api
import argparse
import fnmatch
+import glob
import pathlib
import shutil
import sys
@@ -228,6 +229,9 @@ def cmd_reset(env: api.TestEnvironment, argv: List):
config.queue.write()
+ if args.test == '*':
+ shutil.rmtree(config.logs_dir)
+
def cmd_run(env: api.TestEnvironment, argv: List, update_only: bool):
# Run tests.
parser = argparse.ArgumentParser()
@@ -274,7 +278,17 @@ def cmd_graph(argv: List):
parser.add_argument('-o', '--output', type=str, required=True)
args = parser.parse_args(argv)
- graph = api.TestGraph([pathlib.Path(path) for path in args.json_file])
+ # For directories, use all json files in the directory.
+ json_files = []
+ for path in args.json_file:
+ path = pathlib.Path(path)
+ if path.is_dir():
+ for filepath in glob.iglob(str(path / '*.json')):
+ json_files.append(pathlib.Path(filepath))
+ else:
+ json_files.append(path)
+
+ graph = api.TestGraph(json_files)
graph.write(pathlib.Path(args.output))
def main():
diff --git a/tests/python/bl_blendfile_liblink.py b/tests/python/bl_blendfile_liblink.py
index ab26059e944..760a1a15959 100644
--- a/tests/python/bl_blendfile_liblink.py
+++ b/tests/python/bl_blendfile_liblink.py
@@ -370,10 +370,77 @@ class TestBlendLibAppendReuseID(TestBlendLibLinkHelper):
assert(len(bpy.data.collections) == 0) # Scene's master collection is not listed here
+class TestBlendLibLibraryReload(TestBlendLibLinkHelper):
+
+ def __init__(self, args):
+ self.args = args
+
+ def test_link_reload(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()
+
+ link_dir = os.path.join(output_lib_path, "Object")
+ bpy.ops.wm.link(directory=link_dir, filename="LibMesh")
+
+ assert(len(bpy.data.meshes) == 1)
+ assert(len(bpy.data.objects) == 1)
+ assert(len(bpy.data.collections) == 0) # Scene's master collection is not listed here
+
+ orig_data = self.blender_data_to_tuple(bpy.data, "orig_data")
+
+ bpy.ops.wm.lib_reload(library=bpy.data.objects[0].name)
+
+ reload_data = self.blender_data_to_tuple(bpy.data, "reload_data")
+
+ print(orig_data)
+ print(reload_data)
+ assert(orig_data == reload_data)
+
+
+
+class TestBlendLibLibraryRelocate(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()
+
+ link_dir = os.path.join(output_lib_path, "Object")
+ bpy.ops.wm.link(directory=link_dir, filename="LibMesh")
+
+ assert(len(bpy.data.meshes) == 1)
+ assert(len(bpy.data.objects) == 1)
+ assert(len(bpy.data.collections) == 0) # Scene's master collection is not listed here
+
+ orig_data = self.blender_data_to_tuple(bpy.data, "orig_data")
+
+ lib_path, lib_ext = os.path.splitext(output_lib_path)
+ new_lib_path = lib_path + "_relocate" + lib_ext
+ os.replace(output_lib_path, new_lib_path)
+
+ bpy.ops.wm.lib_relocate(library=bpy.data.objects[0].name, directory="", filename=new_lib_path)
+
+ relocate_data = self.blender_data_to_tuple(bpy.data, "relocate_data")
+
+ print(orig_data)
+ print(relocate_data)
+ assert(orig_data == relocate_data)
+
+
TESTS = (
TestBlendLibLinkSaveLoadBasic,
TestBlendLibAppendBasic,
TestBlendLibAppendReuseID,
+ TestBlendLibLibraryReload,
+ TestBlendLibLibraryRelocate,
)