Files
vt1200/bad-apple/tests/make_fixture.py
T

34 lines
793 B
Python

#!/usr/bin/env python3
"""Write the two-frame fixture the C decoder test reads."""
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from pipeline.movie import (
FrameRecord,
MovieHeader,
Rect,
TileRecord,
write_movie,
)
OUT = ROOT / "player" / "tests" / "fixture.bin"
def main() -> int:
frames = [
FrameRecord(1, 0, [TileRecord(0, 0, [Rect(0, 0, 32, 32)])]),
FrameRecord(1, 0, [TileRecord(1, 1, [Rect(1, 1, 2, 3)])]),
]
header = MovieHeader(64, 32, 2, 32, 2, 1, len(frames), 60, 72)
OUT.parent.mkdir(parents=True, exist_ok=True)
write_movie(str(OUT), frames, header)
return 0
if __name__ == "__main__":
raise SystemExit(main())