mirror of
https://github.com/Dasemu/vnpipe.git
synced 2026-11-26 15:26:27 +00:00
fix(renpy): ship unlabelled placeholders, bigger title cards, translated music credits
Placeholders no longer print the internal asset id; title cards get larger spaced headings and a rule above the subtitle; credits.toml tracks may carry attribution_<language>; slot frame images are generated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d3e7816e65
commit
c759374e4d
5 files changed
+75
-19
No files matched your search
@@ -316,6 +316,7 @@ def test_renpy_condition_switch_and_fallback(work_root, tmp_path):
|
||||
assert 'default persistent.art_style = "paint"' in styles
|
||||
assert "define vn_art_styles = [('paint', 'Paint'), ('ink', 'Ink')]" in styles
|
||||
assert "@@" not in styles
|
||||
assert "$ quick_menu = False" in styles # the picker hides the in-game quick menu
|
||||
assert "call vn_pick_art_style" in (out / "game/script.rpy").read_text(encoding="utf-8")
|
||||
screens = (out / "game/screens.rpy").read_text(encoding="utf-8")
|
||||
assert "Estilo visual" in screens and 'SetField(persistent, "art_style", style_id)' in screens
|
||||
@@ -353,3 +354,26 @@ def test_two_style_project_lints_and_plays(work_root, tmp_path):
|
||||
report = lint.stdout + lint.stderr
|
||||
assert lint.returncode == 0 and "error" not in report.lower(), report
|
||||
test_renpy_gen.run_e2e(out, home)
|
||||
|
||||
|
||||
def test_placeholder_label_only_when_asked():
|
||||
from PIL import ImageChops
|
||||
|
||||
from vnpipe.assets import placeholder
|
||||
|
||||
asset = {"id": "bg_x", "kind": "background"}
|
||||
labelled, plain = placeholder(asset), placeholder(asset, label=False)
|
||||
assert ImageChops.difference(labelled, plain).getbbox() is not None
|
||||
# the shipped placeholder is the plain gradient: no pixel brighter than its last row
|
||||
assert plain.getpixel((0, 0)) != plain.getpixel((0, plain.height - 1)) # a bare gradient
|
||||
|
||||
|
||||
def test_renpy_regenerates_placeholders_and_adds_slot_frames(work_root, tmp_path):
|
||||
assets.ensure_placeholder(
|
||||
work_root, assets.find_asset(assets.load_manifest(work_root), "bg_theatre"), "paint"
|
||||
)
|
||||
out = gen(work_root, tmp_path)
|
||||
shipped = Image.open(out / "game/images/bg/paint/theatre.webp").convert("RGB")
|
||||
assert shipped.getpixel((0, 40)) == shipped.getpixel((300, 40)) # no label on the row
|
||||
assert (out / "game/gui/button/slot_idle_background.png").is_file()
|
||||
assert (out / "game/gui/button/slot_hover_background.png").is_file()
|
||||
+15
-5
@@ -175,7 +175,10 @@ def test_characters_and_images(project):
|
||||
|
||||
def test_title_card_images(project):
|
||||
images = (project / "game/images.rpy").read_text(encoding="utf-8")
|
||||
assert 'image card_talk = Text("CONVERSACIÓN", size=60, text_align=0.5)' in images
|
||||
assert (
|
||||
'image card_talk = Text("CONVERSACIÓN", size=76, kerning=3, text_align=0.5, xmaximum=1600)'
|
||||
in images
|
||||
)
|
||||
assert 'image card_end = Text("Continuará…"' in images
|
||||
|
||||
|
||||
@@ -498,9 +501,12 @@ def test_title_card_subtitle(work, annotated, tmp_path):
|
||||
scenes = [{"heading": "CONVERSACIÓN", "id": "talk", "subtitle": "Escenario · Día"}]
|
||||
out = _project(work, annotated, tmp_path, scenes=scenes)
|
||||
images = (out / "game/images.rpy").read_text(encoding="utf-8")
|
||||
assert 'image card_talk = VBox(Text("CONVERSACIÓN", size=60' in images
|
||||
assert 'Text("Escenario · Día", size=30, italic=True' in images
|
||||
assert 'image card_lyric = Text("LÍRICA", size=60, text_align=0.5)' in images # no subtitle
|
||||
assert 'image card_talk = VBox(Text("CONVERSACIÓN", size=76' in images
|
||||
assert 'Text("Escenario · Día", size=34, italic=True' in images
|
||||
assert (
|
||||
'image card_lyric = Text("LÍRICA", size=76, kerning=3, text_align=0.5, xmaximum=1600)'
|
||||
in images
|
||||
) # no subtitle
|
||||
|
||||
|
||||
def test_scene_labels_and_menus(project, script):
|
||||
@@ -528,8 +534,11 @@ def test_credits_from_work_audio_and_manifest(work, tmp_path):
|
||||
root = tmp_path / "w"
|
||||
(root / "audio").mkdir(parents=True)
|
||||
(root / "audio/a.ogg").write_bytes(b"OggS")
|
||||
(root / "audio/b.ogg").write_bytes(b"OggS")
|
||||
(root / "audio/credits.toml").write_text(
|
||||
'[[track]]\nfile = "audio/a.ogg"\nattribution = "Bach [x]. CC BY-SA 4.0."\n'
|
||||
'[[track]]\nfile = "audio/b.ogg"\nattribution = "Liszt. Performed by X."\n'
|
||||
'attribution_es = "Liszt. Interpretación de X."\n'
|
||||
'[[track]]\nfile = "audio/missing.ogg"\nattribution = "not shipped"\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
@@ -547,7 +556,8 @@ def test_credits_from_work_audio_and_manifest(work, tmp_path):
|
||||
assert sections["Texto"][1] == "Traducción: T. Translator"
|
||||
assert "Proyecto Gutenberg, n.º 42" in sections["Texto"][2]
|
||||
assert sections["Ilustraciones"] == ["Ilustraciones generadas con ChatGPT (OpenAI)"]
|
||||
assert sections["Música"] == ["Bach [[x]. CC BY-SA 4.0."] # verbatim, markup-escaped only
|
||||
# verbatim (markup-escaped only); a translated `attribution_<language>` wins when present
|
||||
assert sections["Música"] == ["Bach [[x]. CC BY-SA 4.0.", "Liszt. Interpretación de X."]
|
||||
|
||||
|
||||
def test_main_menu_background_from_ui(work, annotated, tmp_path):
|
||||
|
||||
Reference in new issue
Block a user