forked from genewildish/Mainline
- Add engine/effects/plugins/figment.py (native pipeline implementation) - Add engine/figment_render.py, engine/figment_trigger.py, engine/themes.py - Add 3 SVG assets in figments/ (Mexican/Aztec motif) - Add engine/display/backends/animation_report.py for debugging - Add engine/pipeline/adapters/frame_capture.py for frame capture - Add test-figment preset to presets.toml - Add cairosvg optional dependency to pyproject.toml - Update EffectPluginStage to support is_overlay attribute (for overlay effects) - Add comprehensive tests: test_figment_effect.py, test_figment_pipeline.py, test_figment_render.py - Remove obsolete test_ui_simple.py - Update TODO.md with test cleanup plan - Refactor test_adapters.py to use real components instead of mocks This completes the figment SVG overlay feature integration using the modern pipeline architecture, avoiding legacy effects_plugins. All tests pass (758 total).
80 lines
2.5 KiB
Python
80 lines
2.5 KiB
Python
"""
|
|
Integration tests for figment effect in the pipeline.
|
|
"""
|
|
|
|
from engine.effects.plugins import discover_plugins
|
|
from engine.effects.registry import get_registry
|
|
from engine.pipeline import Pipeline, PipelineConfig, get_preset
|
|
from engine.pipeline.adapters import (
|
|
EffectPluginStage,
|
|
SourceItemsToBufferStage,
|
|
create_stage_from_display,
|
|
)
|
|
from engine.pipeline.controller import PipelineRunner
|
|
|
|
|
|
class TestFigmentPipeline:
|
|
"""Tests for figment effect in pipeline integration."""
|
|
|
|
def setup_method(self):
|
|
"""Discover plugins before each test."""
|
|
discover_plugins()
|
|
|
|
def test_figment_in_pipeline(self):
|
|
"""Figment effect can be added to pipeline."""
|
|
registry = get_registry()
|
|
figment = registry.get("figment")
|
|
|
|
pipeline = Pipeline(
|
|
config=PipelineConfig(
|
|
source="empty",
|
|
display="null",
|
|
camera="feed",
|
|
effects=["figment"],
|
|
)
|
|
)
|
|
|
|
# Add source stage
|
|
from engine.data_sources.sources import EmptyDataSource
|
|
from engine.pipeline.adapters import DataSourceStage
|
|
|
|
empty_source = EmptyDataSource(width=80, height=24)
|
|
pipeline.add_stage("source", DataSourceStage(empty_source, name="empty"))
|
|
|
|
# Add render stage
|
|
pipeline.add_stage("render", SourceItemsToBufferStage(name="items-to-buffer"))
|
|
|
|
# Add figment effect stage
|
|
pipeline.add_stage("effect_figment", EffectPluginStage(figment, name="figment"))
|
|
|
|
# Add display stage
|
|
from engine.display import DisplayRegistry
|
|
|
|
display = DisplayRegistry.create("null")
|
|
display.init(0, 0)
|
|
pipeline.add_stage("display", create_stage_from_display(display, "null"))
|
|
|
|
# Build and initialize pipeline
|
|
pipeline.build()
|
|
assert pipeline.initialize()
|
|
|
|
# Use PipelineRunner to step through frames
|
|
runner = PipelineRunner(pipeline)
|
|
runner.start()
|
|
|
|
# Run pipeline for a few frames
|
|
for i in range(10):
|
|
runner.step()
|
|
# Result might be None for null display, but that's okay
|
|
|
|
# Verify pipeline ran without errors
|
|
assert pipeline.context.params.frame_number == 10
|
|
|
|
def test_figment_preset(self):
|
|
"""Figment preset is properly configured."""
|
|
preset = get_preset("test-figment")
|
|
assert preset is not None
|
|
assert preset.source == "empty"
|
|
assert preset.display == "terminal"
|
|
assert "figment" in preset.effects
|