Skip to content

Commit 0bdb5d8

Browse files
authored
Merge pull request #53 from MHFU-ModKit/ports/zinogre-names
feat(ports): name 82 of the Zinogre's clips
2 parents 2fda613 + be4f18b commit 0bdb5d8

5 files changed

Lines changed: 396 additions & 27 deletions

File tree

‎apps/studio/tests/monster/conftest.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,14 @@ def workspace(
341341
ws.host_scenes[75] = Scene.from_bytes(synthetic_pac, "em75")
342342
yield ws
343343
ws.close()
344+
345+
346+
@pytest.fixture
347+
def zinogre_toml(ports: Path, tmp_path: Path) -> Path:
348+
"""A copy of the Zinogre's manifest named only welcome_howl and the clips its moves play: the
349+
shipped names change as the owner names clips, so the tests keep their own."""
350+
m = manifest.load(ports / "zinogre.toml")
351+
howl = manifest.Clip(source=2, label="the howling he does when he notices you")
352+
used = {mv.clip for mv in m.moves.values()}
353+
m.clips = {"welcome_howl": howl, **{n: c for n, c in m.clips.items() if n in used}}
354+
return manifest.save(m, tmp_path / "zinogre.toml")

‎apps/studio/tests/monster/test_clip_browser.py‎

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SPDX-License-Identifier: GPL-3.0-or-later
22
# SPDX-FileCopyrightText: 2026 sp00ktober
33
import random
4-
import shutil
54
from collections.abc import Iterator
65
from pathlib import Path
76

@@ -24,11 +23,9 @@ def open_port(games: Data, path: Path) -> MonsterWorkspace:
2423

2524

2625
@pytest.fixture
27-
def zinogre(games: Data, ports: Path, tmp_path: Path) -> Iterator[MonsterWorkspace]:
26+
def zinogre(games: Data, zinogre_toml: Path) -> Iterator[MonsterWorkspace]:
2827
"""The Zinogre opened from a copy of its manifest."""
29-
path = tmp_path / "zinogre.toml"
30-
shutil.copy(ports / "zinogre.toml", path)
31-
ws = open_port(games, path)
28+
ws = open_port(games, zinogre_toml)
3229
yield ws
3330
ws.close()
3431

@@ -121,12 +118,11 @@ def test_place_refusals(zinogre):
121118
assert "past the host's 123" in ws.message and entries(ws) == before
122119

123120

124-
def test_unplaced(games, ports, tmp_path, monkeypatch):
121+
def test_unplaced(games, ports, tmp_path, monkeypatch, zinogre_toml):
125122
"""A host with 100 anims leaves 4 Zinogre clips out: listed, played from a preview, named
126123
without an anim; a placement over a pinned clip has nowhere to send it."""
127124
monkeypatch.setitem(layout.ENTRIES, 75, 100)
128-
path = tmp_path / "zinogre.toml"
129-
shutil.copy(ports / "zinogre.toml", path)
125+
path = zinogre_toml
130126
ws = open_port(games, path)
131127
out = [r.id for r in ws.source_rows() if r.entry is None]
132128
assert len(out) == 4 and len(ws.scene.clips) == 98
@@ -176,15 +172,14 @@ def _clip(frames: int) -> Clip:
176172
return Clip([Track([Channel(0x008, [Keyframe(0, 0), Keyframe(0, frames)])])])
177173

178174

179-
def test_place_every_clip(games, ports, tmp_path):
175+
def test_place_every_clip(games, ports, tmp_path, zinogre_toml):
180176
"""All 102 placed into a shuffled layout, one after another: each lands where it was put
181177
and stays, the saved manifest loads on that layout, and the port builds on it."""
182178
from mhfu_port import build, manifest
183179
from mhfu_studio.monster.clips import pac_clip_table
184180
from mhfu_studio.monster.document import PortDocument
185181

186-
path = tmp_path / "zinogre.toml"
187-
shutil.copy(ports / "zinogre.toml", path)
182+
path = zinogre_toml
188183
doc = PortDocument.open(path)
189184
d, h = build.donor(doc.manifest, games), build.host(doc.manifest, games)
190185
br = B.ClipBrowser(doc, d.clips, h.anim)
@@ -203,11 +198,10 @@ def test_place_every_clip(games, ports, tmp_path):
203198
assert all(table[e] == br.prints[cid] for cid, e in want.items())
204199

205200

206-
def test_view_follows_a_placement(gl, games, ports, tmp_path):
201+
def test_view_follows_a_placement(gl, games, ports, tmp_path, zinogre_toml):
207202
"""On a viewport: the placed clip plays on in its new anim, and undo brings the old build
208203
back on screen."""
209-
path = tmp_path / "zinogre.toml"
210-
shutil.copy(ports / "zinogre.toml", path)
204+
path = zinogre_toml
211205
ws = MonsterWorkspace(games)
212206
ws.intel_cache[75] = None
213207
ws.setup(gl)

‎apps/studio/tests/monster/test_clip_game.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# SPDX-License-Identifier: GPL-3.0-or-later
22
# SPDX-FileCopyrightText: 2026 sp00ktober
3-
import shutil
43
from contextlib import nullcontext
54

65
import pytest
@@ -93,10 +92,9 @@ def test_target():
9392
clip_game.target(Fake(), 75)
9493

9594

96-
def test_play_button(games, ports, tmp_path, game, calls):
95+
def test_play_button(games, ports, tmp_path, game, calls, zinogre_toml):
9796
"""The picked clip's anim reaches the game; a clip moved since the save does not."""
98-
path = tmp_path / "zinogre.toml"
99-
shutil.copy(ports / "zinogre.toml", path)
97+
path = zinogre_toml
10098
ws = MonsterWorkspace(games)
10199
ws.intel_cache[75] = None
102100
ws.open(path)

‎apps/studio/tests/monster/ui/test_clips.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# SPDX-License-Identifier: GPL-3.0-or-later
22
# SPDX-FileCopyrightText: 2026 sp00ktober
3-
import shutil
43
from contextlib import nullcontext
54
from pathlib import Path
65
from typing import Any
@@ -96,9 +95,8 @@ def test_filler_is_loud(workspace: MonsterWorkspace, qtbot: Any) -> None:
9695

9796

9897
@pytest.fixture
99-
def zinogre(games: Any, ports: Path, tmp_path: Path, qtbot: Any) -> ClipsPanel:
100-
path = tmp_path / "zinogre.toml"
101-
shutil.copy(ports / "zinogre.toml", path)
98+
def zinogre(games: Any, qtbot: Any, zinogre_toml: Path) -> ClipsPanel:
99+
path = zinogre_toml
102100
ws = MonsterWorkspace(games)
103101
ws.intel_cache[75] = None
104102
ws.open(path)
@@ -112,12 +110,14 @@ def ids(p: ClipsPanel) -> list[str]:
112110
def test_every_clip(zinogre: ClipsPanel) -> None:
113111
p = zinogre
114112
assert p.table.rowCount() == 102 and not p.table.isColumnHidden(0)
115-
assert p.count.text() == "102 clips in 3 streams, 21 named" and kit.missing_tips(p) == []
113+
named = len(p.ws.doc.manifest.clips)
114+
assert p.count.text() == f"102 clips in 3 streams, {named} named"
115+
assert kit.missing_tips(p) == []
116116
assert ids(p)[:3] == ["1", "2", "4"] and p.table.item(101, 1).text() == "56"
117117
p.filter.setText("stream 2")
118118
assert p.table.rowCount() == 39
119119
p.filter.setText("unnamed")
120-
assert p.table.rowCount() == 81
120+
assert p.table.rowCount() == 102 - named
121121

122122

123123
def test_name_and_next(zinogre: ClipsPanel) -> None:

0 commit comments

Comments
 (0)