feat: new tests
fix: curve diff errors fix: metaball diff error fix: scene error
This commit is contained in:
@@ -87,7 +87,20 @@ class BlCurve(BlDatablock):
|
||||
def _dump_implementation(self, data, instance=None):
|
||||
assert(instance)
|
||||
dumper = Dumper()
|
||||
|
||||
# Conflicting attributes
|
||||
# TODO: remove them with the NURBS support
|
||||
dumper.exclude_filter = [
|
||||
'users',
|
||||
'order_u',
|
||||
'order_v',
|
||||
'point_count_v',
|
||||
'point_count_u',
|
||||
'active_textbox'
|
||||
]
|
||||
if instance.use_auto_texspace:
|
||||
dumper.exclude_filter.extend([
|
||||
'texspace_location',
|
||||
'texspace_size'])
|
||||
data = dumper.dump(instance)
|
||||
data['splines'] = {}
|
||||
|
||||
|
||||
@@ -88,12 +88,15 @@ class BlMetaball(BlDatablock):
|
||||
assert(instance)
|
||||
dumper = Dumper()
|
||||
dumper.depth = 1
|
||||
dumper.exclude_filter = [
|
||||
"is_editmode",
|
||||
"is_evaluated",
|
||||
"is_embedded_data",
|
||||
"is_library_indirect",
|
||||
"name_full"
|
||||
dumper.include_filter = [
|
||||
'name',
|
||||
'resolution',
|
||||
'render_resolution',
|
||||
'threshold',
|
||||
'update_method',
|
||||
'use_auto_texspace',
|
||||
'texspace_location',
|
||||
'texspace_size'
|
||||
]
|
||||
|
||||
data = dumper.dump(instance)
|
||||
|
||||
@@ -37,7 +37,6 @@ class BlScene(BlDatablock):
|
||||
return instance
|
||||
|
||||
def _load_implementation(self, data, target):
|
||||
target = self.instance
|
||||
# Load other meshes metadata
|
||||
loader = Loader()
|
||||
loader.load(target, data)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from deepdiff import DeepDiff
|
||||
|
||||
import bpy
|
||||
import random
|
||||
from multi_user.bl_types.bl_curve import BlCurve
|
||||
|
||||
@pytest.mark.parametrize('curve_type', ['TEXT','BEZIER'])
|
||||
def test_curve(clear_blend, curve_type):
|
||||
if curve_type == 'TEXT':
|
||||
bpy.ops.object.text_add(enter_editmode=False, align='WORLD', location=(0, 0, 0))
|
||||
elif curve_type == 'BEZIER':
|
||||
bpy.ops.curve.primitive_bezier_curve_add(enter_editmode=False, align='WORLD', location=(0, 0, 0))
|
||||
else: #TODO: NURBS support
|
||||
bpy.ops.surface.primitive_nurbs_surface_curve_add(radius=1, enter_editmode=False, align='WORLD', location=(0, 0, 0))
|
||||
|
||||
datablock = bpy.data.curves[0]
|
||||
|
||||
implementation = BlCurve()
|
||||
expected = implementation._dump(datablock)
|
||||
bpy.data.curves.remove(datablock)
|
||||
|
||||
test = implementation._construct(expected)
|
||||
implementation._load(expected, test)
|
||||
result = implementation._dump(test)
|
||||
|
||||
assert not DeepDiff(expected, result)
|
||||
@@ -0,0 +1,23 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from deepdiff import DeepDiff
|
||||
|
||||
import bpy
|
||||
from multi_user.bl_types.bl_lattice import BlLattice
|
||||
|
||||
|
||||
def test_lattice(clear_blend):
|
||||
bpy.ops.object.add(type='LATTICE', enter_editmode=False, align='WORLD', location=(0, 0, 0))
|
||||
|
||||
datablock = bpy.data.lattices[0]
|
||||
|
||||
implementation = BlLattice()
|
||||
expected = implementation._dump(datablock)
|
||||
bpy.data.lattices.remove(datablock)
|
||||
|
||||
test = implementation._construct(expected)
|
||||
implementation._load(expected, test)
|
||||
result = implementation._dump(test)
|
||||
|
||||
assert not DeepDiff(expected, result)
|
||||
@@ -0,0 +1,24 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from deepdiff import DeepDiff
|
||||
|
||||
import bpy
|
||||
from multi_user.bl_types.bl_lightprobe import BlLightprobe
|
||||
|
||||
|
||||
@pytest.mark.skipif(bpy.app.version[1] < 83, reason="requires blender 2.83 or higher")
|
||||
@pytest.mark.parametrize('lightprobe_type', ['PLANAR','GRID','CUBEMAP'])
|
||||
def test_lightprobes(clear_blend, lightprobe_type):
|
||||
bpy.ops.object.lightprobe_add(type=lightprobe_type)
|
||||
|
||||
blender_light = bpy.data.lightprobes[0]
|
||||
lightprobe_dumper = BlLightprobe()
|
||||
expected = lightprobe_dumper._dump(blender_light)
|
||||
bpy.data.lightprobes.remove(blender_light)
|
||||
|
||||
test = lightprobe_dumper._construct(expected)
|
||||
lightprobe_dumper._load(expected, test)
|
||||
result = lightprobe_dumper._dump(test)
|
||||
|
||||
assert not DeepDiff(expected, result)
|
||||
@@ -0,0 +1,23 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from deepdiff import DeepDiff
|
||||
|
||||
import bpy
|
||||
from multi_user.bl_types.bl_metaball import BlMetaball
|
||||
|
||||
|
||||
@pytest.mark.parametrize('metaballs_type', ['PLANE','CAPSULE','BALL','ELLIPSOID','CUBE'])
|
||||
def test_metaball(clear_blend, metaballs_type):
|
||||
bpy.ops.object.metaball_add(type=metaballs_type)
|
||||
|
||||
datablock = bpy.data.metaballs[0]
|
||||
dumper = BlMetaball()
|
||||
expected = dumper._dump(datablock)
|
||||
bpy.data.metaballs.remove(datablock)
|
||||
|
||||
test = dumper._construct(expected)
|
||||
dumper._load(expected, test)
|
||||
result = dumper._dump(test)
|
||||
|
||||
assert not DeepDiff(expected, result)
|
||||
@@ -0,0 +1,22 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from deepdiff import DeepDiff
|
||||
|
||||
import bpy
|
||||
import random
|
||||
from multi_user.bl_types.bl_scene import BlScene
|
||||
|
||||
def test_scene(clear_blend):
|
||||
datablock = bpy.data.scenes.new("toto")
|
||||
|
||||
# Test
|
||||
implementation = BlScene()
|
||||
expected = implementation._dump(datablock)
|
||||
bpy.data.scenes.remove(datablock)
|
||||
|
||||
test = implementation._construct(expected)
|
||||
implementation._load(expected, test)
|
||||
result = implementation._dump(test)
|
||||
|
||||
assert not DeepDiff(expected, result)
|
||||
Reference in New Issue
Block a user