Files
Mainline/test_ui_simple.py
David Gwilliam cdcdb7b172 feat(app): add direct CLI mode, validation framework, fixtures, and UI panel integration
- Add run_pipeline_mode_direct() for constructing pipelines from CLI flags
- Add engine/pipeline/validation.py with validate_pipeline_config() and MVP rules
- Add fixtures system: engine/fixtures/headlines.json for cached test data
- Enhance fetch.py to use fixtures cache path
- Support fixture source in run_pipeline_mode()
- Add --pipeline-* CLI flags: source, effects, camera, display, UI, border
- Integrate UIPanel: raw mode, preset picker, event callbacks, param adjustment
- Add UI_PRESET support in app and hot-rebuild pipeline on preset change
- Add test UIPanel rendering and interaction tests

This provides a flexible pipeline construction interface with validation and interactive control.

Fixes #29, #30, #31
2026-03-18 12:19:18 -07:00

57 lines
1.2 KiB
Python

"""
Simple test for UIPanel integration.
"""
from engine.pipeline.ui import UIPanel, UIConfig, StageControl
# Create panel
panel = UIPanel(UIConfig(panel_width=24))
# Add some mock stages
panel.register_stage(
type(
"Stage", (), {"name": "noise", "category": "effect", "is_enabled": lambda: True}
),
enabled=True,
)
panel.register_stage(
type(
"Stage", (), {"name": "fade", "category": "effect", "is_enabled": lambda: True}
),
enabled=False,
)
panel.register_stage(
type(
"Stage",
(),
{"name": "glitch", "category": "effect", "is_enabled": lambda: True},
),
enabled=True,
)
panel.register_stage(
type(
"Stage",
(),
{"name": "font", "category": "transform", "is_enabled": lambda: True},
),
enabled=True,
)
# Select first stage
panel.select_stage("noise")
# Render at 80x24
lines = panel.render(80, 24)
print("\n".join(lines))
print("\nStage list:")
for name, ctrl in panel.stages.items():
print(f" {name}: enabled={ctrl.enabled}, selected={ctrl.selected}")
print("\nToggle 'fade' and re-render:")
panel.toggle_stage("fade")
lines = panel.render(80, 24)
print("\n".join(lines))
print("\nEnabled stages:", panel.get_enabled_stages())