forked from genewildish/Mainline
refactor: move effects_plugins to engine/effects/plugins
- Move effects_plugins/ to engine/effects/plugins/ - Update imports in engine/app.py - Update imports in all test files - Follows capability-based deps architecture Closes #27
This commit is contained in:
@@ -5,7 +5,7 @@ Application orchestrator — pipeline mode entry point.
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import effects_plugins
|
import engine.effects.plugins as effects_plugins
|
||||||
from engine import config
|
from engine import config
|
||||||
from engine.display import DisplayRegistry
|
from engine.display import DisplayRegistry
|
||||||
from engine.effects import PerformanceMonitor, get_registry, set_monitor
|
from engine.effects import PerformanceMonitor, get_registry, set_monitor
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ def discover_plugins():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
module = __import__(f"effects_plugins.{module_name}", fromlist=[""])
|
module = __import__(f"engine.effects.plugins.{module_name}", fromlist=[""])
|
||||||
for attr_name in dir(module):
|
for attr_name in dir(module):
|
||||||
attr = getattr(module, attr_name)
|
attr = getattr(module, attr_name)
|
||||||
if (
|
if (
|
||||||
@@ -37,8 +37,8 @@ class TestBenchmarkNullDisplay:
|
|||||||
"""Effects should meet minimum processing throughput."""
|
"""Effects should meet minimum processing throughput."""
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from effects_plugins import discover_plugins
|
|
||||||
from engine.effects import EffectContext, get_registry
|
from engine.effects import EffectContext, get_registry
|
||||||
|
from engine.effects.plugins import discover_plugins
|
||||||
|
|
||||||
discover_plugins()
|
discover_plugins()
|
||||||
registry = get_registry()
|
registry = get_registry()
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
Tests for BorderEffect.
|
Tests for BorderEffect.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from engine.effects.plugins.border import BorderEffect
|
||||||
from effects_plugins.border import BorderEffect
|
|
||||||
from engine.effects.types import EffectContext
|
from engine.effects.types import EffectContext
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
Tests for CropEffect.
|
Tests for CropEffect.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from engine.effects.plugins.crop import CropEffect
|
||||||
from effects_plugins.crop import CropEffect
|
|
||||||
from engine.effects.types import EffectContext
|
from engine.effects.types import EffectContext
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class TestGlitchEffectStability:
|
|||||||
|
|
||||||
def test_glitch_preserves_line_count(self, effect_context, stable_buffer):
|
def test_glitch_preserves_line_count(self, effect_context, stable_buffer):
|
||||||
"""Glitch should not change the number of lines in buffer."""
|
"""Glitch should not change the number of lines in buffer."""
|
||||||
from effects_plugins.glitch import GlitchEffect
|
from engine.effects.plugins.glitch import GlitchEffect
|
||||||
|
|
||||||
effect = GlitchEffect()
|
effect = GlitchEffect()
|
||||||
result = effect.process(stable_buffer, effect_context)
|
result = effect.process(stable_buffer, effect_context)
|
||||||
@@ -50,7 +50,7 @@ class TestGlitchEffectStability:
|
|||||||
|
|
||||||
Note: Effects may add ANSI color codes, so we check VISIBLE length (stripped).
|
Note: Effects may add ANSI color codes, so we check VISIBLE length (stripped).
|
||||||
"""
|
"""
|
||||||
from effects_plugins.glitch import GlitchEffect
|
from engine.effects.plugins.glitch import GlitchEffect
|
||||||
|
|
||||||
effect = GlitchEffect()
|
effect = GlitchEffect()
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ class TestGlitchEffectStability:
|
|||||||
Regression test: Previously glitch used \\033[{row};1H which caused
|
Regression test: Previously glitch used \\033[{row};1H which caused
|
||||||
conflicts with HUD and border rendering.
|
conflicts with HUD and border rendering.
|
||||||
"""
|
"""
|
||||||
from effects_plugins.glitch import GlitchEffect
|
from engine.effects.plugins.glitch import GlitchEffect
|
||||||
|
|
||||||
effect = GlitchEffect()
|
effect = GlitchEffect()
|
||||||
result = effect.process(stable_buffer, effect_context)
|
result = effect.process(stable_buffer, effect_context)
|
||||||
@@ -86,7 +86,7 @@ class TestGlitchEffectStability:
|
|||||||
self, effect_context, stable_buffer
|
self, effect_context, stable_buffer
|
||||||
):
|
):
|
||||||
"""Glitch output should be deterministic given the same random seed."""
|
"""Glitch output should be deterministic given the same random seed."""
|
||||||
from effects_plugins.glitch import GlitchEffect
|
from engine.effects.plugins.glitch import GlitchEffect
|
||||||
|
|
||||||
effect = GlitchEffect()
|
effect = GlitchEffect()
|
||||||
effect.config = EffectConfig(enabled=True, intensity=1.0)
|
effect.config = EffectConfig(enabled=True, intensity=1.0)
|
||||||
@@ -127,9 +127,9 @@ class TestEffectViewportStability:
|
|||||||
|
|
||||||
def test_effect_chain_preserves_dimensions(self):
|
def test_effect_chain_preserves_dimensions(self):
|
||||||
"""Effect chain should preserve buffer dimensions."""
|
"""Effect chain should preserve buffer dimensions."""
|
||||||
from effects_plugins.fade import FadeEffect
|
from engine.effects.plugins.fade import FadeEffect
|
||||||
from effects_plugins.glitch import GlitchEffect
|
from engine.effects.plugins.glitch import GlitchEffect
|
||||||
from effects_plugins.noise import NoiseEffect
|
from engine.effects.plugins.noise import NoiseEffect
|
||||||
|
|
||||||
ctx = EffectContext(
|
ctx = EffectContext(
|
||||||
terminal_width=80,
|
terminal_width=80,
|
||||||
@@ -152,7 +152,9 @@ class TestEffectViewportStability:
|
|||||||
assert len(buffer) == original_len, (
|
assert len(buffer) == original_len, (
|
||||||
f"{effect.name} changed line count from {original_len} to {len(buffer)}"
|
f"{effect.name} changed line count from {original_len} to {len(buffer)}"
|
||||||
)
|
)
|
||||||
for i, (orig_w, new_line) in enumerate(zip(original_widths, buffer, strict=False)):
|
for i, (orig_w, new_line) in enumerate(
|
||||||
|
zip(original_widths, buffer, strict=False)
|
||||||
|
):
|
||||||
visible_len = len(strip_ansi(new_line))
|
visible_len = len(strip_ansi(new_line))
|
||||||
assert visible_len == orig_w, (
|
assert visible_len == orig_w, (
|
||||||
f"{effect.name} changed line {i} visible width from {orig_w} to {visible_len}"
|
f"{effect.name} changed line {i} visible width from {orig_w} to {visible_len}"
|
||||||
@@ -181,7 +183,7 @@ class TestEffectTestMatrix:
|
|||||||
pytest.skip("Border handled by display")
|
pytest.skip("Border handled by display")
|
||||||
else:
|
else:
|
||||||
effect_module = __import__(
|
effect_module = __import__(
|
||||||
f"effects_plugins.{effect_name}",
|
f"engine.effects.plugins.{effect_name}",
|
||||||
fromlist=[f"{effect_name.title()}Effect"],
|
fromlist=[f"{effect_name.title()}Effect"],
|
||||||
)
|
)
|
||||||
effect_class = getattr(effect_module, f"{effect_name.title()}Effect")
|
effect_class = getattr(effect_module, f"{effect_name.title()}Effect")
|
||||||
@@ -213,7 +215,7 @@ class TestEffectTestMatrix:
|
|||||||
"""Effects should not use cursor positioning (causes display conflicts)."""
|
"""Effects should not use cursor positioning (causes display conflicts)."""
|
||||||
try:
|
try:
|
||||||
effect_module = __import__(
|
effect_module = __import__(
|
||||||
f"effects_plugins.{effect_name}",
|
f"engine.effects.plugins.{effect_name}",
|
||||||
fromlist=[f"{effect_name.title()}Effect"],
|
fromlist=[f"{effect_name.title()}Effect"],
|
||||||
)
|
)
|
||||||
effect_class = getattr(effect_module, f"{effect_name.title()}Effect")
|
effect_class = getattr(effect_module, f"{effect_name.title()}Effect")
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
|
|
||||||
from engine.effects.performance import PerformanceMonitor, set_monitor
|
from engine.effects.performance import PerformanceMonitor, set_monitor
|
||||||
from engine.effects.types import EffectContext
|
from engine.effects.types import EffectContext
|
||||||
|
|
||||||
|
|
||||||
def test_hud_effect_adds_hud_lines():
|
def test_hud_effect_adds_hud_lines():
|
||||||
"""Test that HUD effect adds HUD lines to the buffer."""
|
"""Test that HUD effect adds HUD lines to the buffer."""
|
||||||
from effects_plugins.hud import HudEffect
|
from engine.effects.plugins.hud import HudEffect
|
||||||
|
|
||||||
set_monitor(PerformanceMonitor())
|
set_monitor(PerformanceMonitor())
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ def test_hud_effect_adds_hud_lines():
|
|||||||
|
|
||||||
def test_hud_effect_shows_current_effect():
|
def test_hud_effect_shows_current_effect():
|
||||||
"""Test that HUD displays the correct effect name."""
|
"""Test that HUD displays the correct effect name."""
|
||||||
from effects_plugins.hud import HudEffect
|
from engine.effects.plugins.hud import HudEffect
|
||||||
|
|
||||||
set_monitor(PerformanceMonitor())
|
set_monitor(PerformanceMonitor())
|
||||||
|
|
||||||
@@ -80,7 +79,7 @@ def test_hud_effect_shows_current_effect():
|
|||||||
|
|
||||||
def test_hud_effect_shows_intensity():
|
def test_hud_effect_shows_intensity():
|
||||||
"""Test that HUD displays intensity percentage."""
|
"""Test that HUD displays intensity percentage."""
|
||||||
from effects_plugins.hud import HudEffect
|
from engine.effects.plugins.hud import HudEffect
|
||||||
|
|
||||||
set_monitor(PerformanceMonitor())
|
set_monitor(PerformanceMonitor())
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from effects_plugins.tint import TintEffect
|
from engine.effects.plugins.tint import TintEffect
|
||||||
from engine.effects.types import EffectConfig
|
from engine.effects.types import EffectConfig
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user