Layers unittesting: update after doversion changes

Collections now are called "Collection 1", instead of "1"
This commit is contained in:
Dalai Felinto 2017-03-20 10:30:19 +01:00
parent 01c4e598e5
commit a6d4ac28f5
9 changed files with 29 additions and 0 deletions

View File

@ -258,6 +258,7 @@ class RenderLayerTesting(unittest.TestCase):
# open file
bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
self.rename_collections()
# create sub-collections
three_b = bpy.data.objects.get('T.3b')
@ -360,6 +361,25 @@ class RenderLayerTesting(unittest.TestCase):
while master_collection.collections:
master_collection.collections.remove(master_collection.collections[0])
def rename_collections(self, collection=None):
"""
Rename 'Collection 1' to '1'
"""
def strip_name(collection):
import re
if collection.name.startswith("Default Collection"):
collection.name = '1'
else:
collection.name = re.findall(r'\d+', collection.name)[0]
if collection is None:
import bpy
collection = bpy.context.scene.master_collection
for nested_collection in collection.collections:
strip_name(nested_collection)
self.rename_collections(nested_collection)
class MoveSceneCollectionTesting(RenderLayerTesting):
"""

View File

@ -30,6 +30,7 @@ class UnitTesting(RenderLayerTesting):
# open file
bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
self.rename_collections()
# create sub-collections
three_b = bpy.data.objects.get('T.3b')

View File

@ -29,6 +29,7 @@ class UnitTesting(RenderLayerTesting):
# open file
bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
self.rename_collections()
# create sub-collections
three_b = bpy.data.objects.get('T.3b')

View File

@ -30,6 +30,7 @@ class UnitTesting(RenderLayerTesting):
# open file
bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
self.rename_collections()
# create sub-collections
three_b = bpy.data.objects.get('T.3b')

View File

@ -30,6 +30,7 @@ class UnitTesting(RenderLayerTesting):
# open file
bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
self.rename_collections()
# create sub-collections
three_b = bpy.data.objects.get('T.3b')

View File

@ -75,6 +75,7 @@ class UnitTesting(RenderLayerTesting):
ROOT = self.get_root()
filepath_layers = os.path.join(ROOT, 'layers.blend')
bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
self.rename_collections()
# change the file
three_b = bpy.data.objects.get('T.3b')

View File

@ -36,6 +36,7 @@ class UnitTesting(RenderLayerTesting):
filepath_json = os.path.join(dirpath, "{0}.json".format(copy_mode))
bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
self.rename_collections()
bpy.ops.scene.new(type=copy_mode)
bpy.ops.wm.save_mainfile('EXEC_DEFAULT', filepath=filepath_saved)

View File

@ -35,6 +35,7 @@ class UnitTesting(RenderLayerTesting):
# doversion + write test
bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
self.rename_collections()
bpy.ops.wm.save_mainfile('EXEC_DEFAULT', filepath=filepath_doversion)
datas = query_scene(filepath_doversion, 'Main', data_callbacks)
@ -54,6 +55,7 @@ class UnitTesting(RenderLayerTesting):
if do_read:
# read test, simply open and save the file
bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_doversion)
self.rename_collections()
bpy.ops.wm.save_mainfile('EXEC_DEFAULT', filepath=filepath_saved)
datas = query_scene(filepath_saved, 'Main', data_callbacks)

View File

@ -29,6 +29,7 @@ class UnitTesting(RenderLayerTesting):
# open file
bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
self.rename_collections()
# create sub-collections
three_b = bpy.data.objects.get('T.3b')