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')
-rw-r--r--tests/python/bl_blendfile_library_overrides.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/python/bl_blendfile_library_overrides.py b/tests/python/bl_blendfile_library_overrides.py
index 358f77d49ea..b44e4d48564 100644
--- a/tests/python/bl_blendfile_library_overrides.py
+++ b/tests/python/bl_blendfile_library_overrides.py
@@ -59,9 +59,9 @@ class TestLibraryOverrides(TestHelper, unittest.TestCase):
self.assertIsNone(local_id.data.override_library)
assert(len(local_id.override_library.properties) == 0)
+ ##### Generate an override property & operation automaticaly by editing the local override data.
local_id.location.y = 1.0
local_id.override_library.operations_update()
-
assert(len(local_id.override_library.properties) == 1)
override_prop = local_id.override_library.properties[0]
assert(override_prop.rna_path == "location")
@@ -71,11 +71,31 @@ class TestLibraryOverrides(TestHelper, unittest.TestCase):
# Setting location.y overridded all elements in the location array. -1 is a wildcard.
assert(override_operation.subitem_local_index == -1)
+ ##### Reset the override to its linked reference data.
local_id.override_library.reset()
-
assert(len(local_id.override_library.properties) == 0)
assert(local_id.location == local_id.override_library.reference.location)
+ ##### Generate an override property & operation manually using the API.
+ override_property = local_id.override_library.properties.add(rna_path="location")
+ override_property.operations.add(operation='REPLACE')
+
+ assert(len(local_id.override_library.properties) == 1)
+ override_prop = local_id.override_library.properties[0]
+ assert(override_prop.rna_path == "location")
+ assert(len(override_prop.operations) == 1)
+ override_operation = override_prop.operations[0]
+ assert(override_operation.operation == 'REPLACE')
+ # Setting location.y overridded all elements in the location array. -1 is a wildcard.
+ assert(override_operation.subitem_local_index == -1)
+
+ override_property = local_id.override_library.properties[0]
+ override_property.operations.remove(override_property.operations[0])
+ local_id.override_library.properties.remove(override_property)
+
+ assert(len(local_id.override_library.properties) == 0)
+
+ ##### Delete the override.
local_id_name = local_id.name
assert(bpy.data.objects.get((local_id_name, None), None) == local_id)
local_id.override_library.destroy()