fixes doc generation and renderers 2
Some checks failed
Deploy Plattform-Core (Int) / test (push) Failing after 59s
Deploy Plattform-Core (Int) / deploy (push) Has been skipped

This commit is contained in:
ValueOn AG 2026-06-03 17:02:18 +02:00
parent 2eb1a5589d
commit 60bb771158

View file

@ -3,9 +3,7 @@
import pytest
from modules.serviceCenter.services.serviceGeneration.styleDefaults import (
resolveStyle,
resolveTheme,
DEFAULT_STYLE,
THEME_PRESETS,
)
@ -49,45 +47,3 @@ def test_override_document_title_partial_merge():
assert result["documentTitle"]["sizePt"] == 32
assert result["documentTitle"]["align"] == "center"
assert result["headings"]["h1"]["sizePt"] == DEFAULT_STYLE["headings"]["h1"]["sizePt"]
# ── Theme presets (A3) ─────────────────────────────────────────────
def test_resolve_theme_unknown_is_empty():
assert resolveTheme(None) == {}
assert resolveTheme("does-not-exist") == {}
def test_resolve_theme_case_insensitive():
assert resolveTheme("FINANCE") == THEME_PRESETS["finance"]
def test_general_theme_equals_defaults():
assert resolveStyle(None, "general") == DEFAULT_STYLE
def test_theme_applies_preset_over_defaults():
result = resolveStyle(None, "legal")
# legal preset changes the primary font to a serif and justifies body text
assert result["fonts"]["primary"] == "Times New Roman"
assert result["paragraph"]["align"] == "justify"
# untouched keys still come from DEFAULT_STYLE
assert result["page"]["format"] == DEFAULT_STYLE["page"]["format"]
def test_explicit_style_overrides_theme():
# theme sets finance green; explicit style must win
result = resolveStyle({"colors": {"primary": "#FF0000"}}, "finance")
assert result["colors"]["primary"] == "#FF0000"
# non-overridden theme key still applies
assert result["table"]["headerBg"] == THEME_PRESETS["finance"]["table"]["headerBg"]
def test_marketing_theme_enlarges_title_and_images():
result = resolveStyle(None, "marketing")
assert result["documentTitle"]["sizePt"] == 34
assert result["image"]["defaultWidthPt"] == 540
def test_unknown_theme_falls_back_to_defaults():
assert resolveStyle(None, "rainbow") == DEFAULT_STYLE