This commit is contained in:
2025-10-13 13:35:52 +02:00
parent 2494897360
commit bf636cbc66
21 changed files with 331 additions and 276 deletions

View File

@@ -485,7 +485,8 @@ class TestGenerateTextureImage:
overlay = MagicMock()
overlay.enabled = True
overlay.image_path = str(overlay_path)
overlay.positioning_mode = 'ABSOLUTE'
overlay.component_type = 'IMAGE'
overlay.placement_mode = 'ABSOLUTE'
overlay.x_position = 0.5
overlay.y_position = 0.5
overlay.scale = 1.0
@@ -537,7 +538,8 @@ class TestGenerateTextureImage:
overlay = MagicMock()
overlay.enabled = True
overlay.image_path = str(svg_path)
overlay.positioning_mode = 'ABSOLUTE'
overlay.component_type = 'IMAGE'
overlay.placement_mode = 'ABSOLUTE'
overlay.x_position = 0.5
overlay.y_position = 0.5
overlay.scale = 1.0
@@ -580,7 +582,8 @@ class TestGenerateTextureImage:
overlay = MagicMock()
overlay.enabled = True
overlay.image_path = ""
overlay.positioning_mode = 'ABSOLUTE'
overlay.component_type = 'IMAGE'
overlay.placement_mode = 'ABSOLUTE'
overlay.x_position = 0.5
overlay.y_position = 0.5
overlay.scale = 1.0
@@ -619,7 +622,8 @@ class TestGenerateTextureImage:
overlay = MagicMock()
overlay.enabled = True
overlay.image_path = str(overlay_path)
overlay.positioning_mode = 'APPEND'
overlay.component_type = 'IMAGE'
overlay.placement_mode = 'APPEND'
overlay.text_spacing = 10.0 # push further right
overlay.image_spacing = 0.0
overlay.scale = 1.0
@@ -676,7 +680,8 @@ class TestGenerateTextureImage:
overlay = MagicMock()
overlay.enabled = True
overlay.image_path = str(overlay_path)
overlay.positioning_mode = 'PREPEND'
overlay.component_type = 'IMAGE'
overlay.placement_mode = 'PREPEND'
overlay.text_spacing = 10.0 # push further left
overlay.image_spacing = 0.0
overlay.scale = 1.0

View File

@@ -94,7 +94,6 @@ def make_default_props(**overrides):
manual_position_x=50.0,
manual_position_y=50.0,
constrain_to_canvas=True,
composition_active_tab="TEXT",
image_overlays=[],
active_overlay_index=0,
)
@@ -134,14 +133,24 @@ def test_positioning_section_drops_additional_text(monkeypatch):
assert "append_text" not in prop_names
def test_composition_section_shows_text_controls(monkeypatch):
"""Composition panel should surface text controls when text tab is active."""
def test_composition_section_renders_text_component(monkeypatch):
"""Composition panel should show text component controls within the proper section."""
layout = FakeLayout()
props = make_default_props(
composition_active_tab="TEXT",
prepend_text="Intro",
append_text="Outro",
text_component = SimpleNamespace(
enabled=True,
name="Intro Text",
component_type="TEXT",
placement_mode="PREPEND",
text_content="Intro",
text_spacing=10.0,
image_spacing=5.0,
x_position=0.5,
y_position=0.5,
scale=1.0,
rotation=0.0,
z_index=0,
)
props = make_default_props(image_overlays=[text_component])
monkeypatch.setattr(panels, "safe_operator_call", lambda *args, **kwargs: SimpleNamespace())
monkeypatch.setattr(panels, "has_image_overlays", lambda: True)
@@ -151,21 +160,24 @@ def test_composition_section_shows_text_controls(monkeypatch):
calls = collect_calls(layout)
prop_names = [data["name"] for kind, data in calls if kind == "prop"]
labels = [data["text"] for kind, data in calls if kind == "label"]
sections = [text for text in labels if "Components" in text]
assert "composition_active_tab" in prop_names
assert "prepend_text" in prop_names
assert "append_text" in prop_names
assert any("Text" in text for text in labels)
assert "component_type" in prop_names
assert "text_content" in prop_names
assert "placement_mode" in prop_names
assert "text_spacing" in prop_names
assert "Prepended Components" in sections
def test_composition_section_shows_overlay_controls(monkeypatch):
"""Composition panel should surface overlay controls when image tab is active."""
def test_composition_section_renders_image_component(monkeypatch):
"""Composition panel should show image component controls within the proper section."""
layout = FakeLayout()
overlay = SimpleNamespace(
image_component = SimpleNamespace(
enabled=True,
name="Logo",
component_type="IMAGE",
placement_mode="ABSOLUTE",
image_path="/tmp/logo.png",
positioning_mode="ABSOLUTE",
x_position=0.5,
y_position=0.5,
text_spacing=10.0,
@@ -174,10 +186,7 @@ def test_composition_section_shows_overlay_controls(monkeypatch):
rotation=0.0,
z_index=1,
)
props = make_default_props(
composition_active_tab="IMAGE",
image_overlays=[overlay],
)
props = make_default_props(image_overlays=[image_component])
monkeypatch.setattr(panels, "safe_operator_call", lambda *args, **kwargs: SimpleNamespace())
monkeypatch.setattr(panels, "has_image_overlays", lambda: True)
@@ -187,7 +196,10 @@ def test_composition_section_shows_overlay_controls(monkeypatch):
calls = collect_calls(layout)
prop_names = [data["name"] for kind, data in calls if kind == "prop"]
labels = [data["text"] for kind, data in calls if kind == "label"]
sections = [text for text in labels if "Components" in text]
assert "composition_active_tab" in prop_names
assert "positioning_mode" in prop_names
assert any("Image" in text for text in labels)
assert "component_type" in prop_names
assert "image_path" in prop_names
assert "placement_mode" in prop_names
assert "x_position" in prop_names
assert "Absolute Components" in sections