Clone
1
Test-&-QA
Matteo Benedetto edited this page 2026-07-01 10:21:55 +00:00

Test & QA

Script di test headless per validare build e gameplay.

Setup

pip install --user Pillow pyboy opencv-python numpy

Test 1 — ROM game over (isolato)

Compila una ROM minimale che porta immediatamente al game over, utile per testare la schermata death:

make build/test_gameover.gb

Questo crea un binario che entra direttamente in show_death() con un metasprite GAME OVER. Da testare con screenshot.

Test 2 — ROM finale (isolato)

Stessa idea, ma per la schermata finale:

make build/test_finale.gb

Va direttamente al finale con la musica. Utile per testare la sequenza audio lunga.

Test 3 — Movimento WRAM

scripts/test_movement.py legge la WRAM via PyBoy e verifica che il movimento cambi le coordinate del player:

python3 scripts/test_movement.py

Controlla:

  • Pressione DPad → player_lx/ly cambiano
  • Rilascio → no input
  • DAS delay funziona
  • Sprint (B) consuma stamina

Test 4 — Screenshot diff

scripts/test_pyboy.py cattura screenshot di ogni schermata e li salva in assets/screenshots/:

python3 scripts/test_pyboy.py

Produce:

  • title.png
  • gameplay_lv1.png
  • gameplay_lv2.png
  • gameplay_lv3.png
  • gameover.png

Test 5 — Glitch detection (OpenCV)

scripts/opencv_analyze_tiles.py usa OpenCV per rilevare glitch visivi (tile sballati, posizioni sbagliate):

python3 scripts/opencv_analyze_tiles.py assets/screenshot.png

Output: lista di anomalie con coordinate (x, y) e tipo.

Test 6 — ROM size sanity

ls -la build/hello_iso.gb
# deve essere esattamente 32768 bytes

Test 7 — Verifica header GB

xxd build/hello_iso.gb | head -8
# deve mostrare il logo Nintendo e il titolo "HELLO_ISO" o simile

Test 8 — BGB debugger

Se hai BGB (https://bgb.bircd.org/):

  1. Apri build/hello_iso.gb
  2. Window > Tile viewer → controlla i tile in VRAM
  3. Window > Map viewer → controlla il BG map
  4. Window > OAM viewer → controlla gli sprite
  5. Window > IO Map → monitora SCX, SCY, LY, ecc.

Continuous Integration (TODO)

Una CI con GitHub Actions potrebbe:

  1. Compilare con GBDK
  2. Verificare dimensione ROM
  3. Lanciare i test PyBoy in CI container
  4. Confrontare screenshot con baseline (visual regression)
  5. Pubblicare release su tag v*

Per ora i test sono manuali.