2024-02-18 16:14:31 +00:00
|
|
|
import bpy
|
2024-03-04 07:20:00 +00:00
|
|
|
from .setup_data import setup_data
|
2024-02-18 16:14:31 +00:00
|
|
|
|
2024-03-04 07:20:00 +00:00
|
|
|
def test_blend(setup_data):
|
2024-02-18 16:14:31 +00:00
|
|
|
registry = bpy.context.window_manager.components_registry
|
2024-08-14 14:40:59 +00:00
|
|
|
registry.schema_path = setup_data["components_schemaPath"]
|
2024-02-18 16:14:31 +00:00
|
|
|
bpy.ops.object.reload_registry()
|
|
|
|
|
2024-08-14 14:40:59 +00:00
|
|
|
long_name = "bevy_example::test_components::BasicTest"
|
2024-02-18 16:14:31 +00:00
|
|
|
|
|
|
|
add_component_operator = bpy.ops.object.add_bevy_component
|
2024-08-14 14:40:59 +00:00
|
|
|
add_component_operator(component_type=long_name)
|
2024-02-18 16:14:31 +00:00
|
|
|
|
2024-08-14 14:40:59 +00:00
|
|
|
property_group_name = registry.get_propertyGroupName_from_longName(long_name)
|
2024-02-18 16:14:31 +00:00
|
|
|
object = bpy.context.object
|
|
|
|
|
|
|
|
target_components_metadata = object.components_meta.components
|
2024-08-14 14:40:59 +00:00
|
|
|
component_meta = next(filter(lambda component: component["long_name"] == long_name, target_components_metadata), None)
|
2024-02-18 16:14:31 +00:00
|
|
|
propertyGroup = getattr(component_meta, property_group_name, None)
|
|
|
|
|
|
|
|
|
|
|
|
assert propertyGroup.field_names == ['a', 'b', 'c']
|