List and edit in-memory sounds in soundbanks
This commit is contained in:
@@ -4,7 +4,7 @@ import os
|
||||
|
||||
import pytest
|
||||
|
||||
from ackit import classify
|
||||
from ackit import banks, classify
|
||||
from ackit.catalog import Catalog, read_csv, load_characters
|
||||
from ackit.game import Game
|
||||
from ackit.paths import catalog_dir
|
||||
@@ -63,15 +63,24 @@ def test_shipped_csvs_are_consistent():
|
||||
keys = {r.key for r in rows}
|
||||
assert len(keys) == len(rows), f
|
||||
assert all(r.group in classify.GROUPS for r in rows)
|
||||
assert all(len(r.sha1) == 16 for r in rows)
|
||||
assert len({r.name.lower() for r in rows}) == len(rows), f
|
||||
# no checksum only where the copies of a BANK sound differ (1C898731)
|
||||
assert sum(len(r.sha1) != 16 for r in rows) <= (1 if f == "BANK.csv" else 0), f
|
||||
hdr = next(csv.reader(open(os.path.join(catalog_dir(), "ITA.csv"), encoding="utf-8")))
|
||||
assert hdr[:3] == ["archive", "target", "name"]
|
||||
locs = banks.read_locations(os.path.join(catalog_dir(), banks.LOCATIONS))
|
||||
bank = {r.target for r in read_csv(os.path.join(catalog_dir(), "BANK.csv"))}
|
||||
assert {"%08X" % m for m, ls in locs.items() if ls[0].kind == "m"} == bank
|
||||
assert all(l.sound for ls in locs.values() for l in ls if l.kind == "p")
|
||||
|
||||
|
||||
@pytest.mark.game
|
||||
def test_real_game_uses_shipped_catalog(real_game_dir):
|
||||
g = Game(real_game_dir)
|
||||
cat = Catalog(g, ["ITA", "SFX"])
|
||||
assert len(cat.sounds) == 10816 + 651
|
||||
cat = Catalog(g, ["ITA", "SFX", "BANK"])
|
||||
assert len(cat.sounds) == 10816 + 651 + 15404
|
||||
s = cat.resolve("Speech_TAPE_JOKER_1_4")
|
||||
assert s.category == "Interview tapes" and s.size == 44985
|
||||
assert len(cat.heads) == 396 and sum(len(v) for v in cat.heads.values()) == 2101
|
||||
b = cat.resolve("Play_BatmanDeviceImpact_Wood_1")
|
||||
assert b.archive == "BANK" and b.group == "SFX"
|
||||
|
||||
Reference in New Issue
Block a user