Add API verification test suite and documentation

tests/docs/:
- API_FINDINGS.md: Comprehensive migration guide from deprecated to modern API
- test_*.py: 9 executable tests verifying actual runtime behavior
- screenshots/: Visual verification of working examples

tests/conftest.py:
- Add 'docs' and 'demo' to pytest collection paths

Key findings documented:
- Entity uses grid_pos= not pos=
- Scene API: Scene() + activate() replaces createScene/setScene
- scene.children replaces sceneUI()
- scene.on_key replaces keypressScene()
- mcrfpy.current_scene (property) replaces currentScene() (function)
- Timer callback signature: (timer, runtime)
- Opacity animation does NOT work on Frame (documented bug)

🤖 Generated with Claude Code (https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Frick 2026-01-15 04:05:32 +00:00
commit 23afae69ad
17 changed files with 620 additions and 2 deletions

View file

@ -0,0 +1,48 @@
#!/usr/bin/env python3
"""Test for quickstart.md 'Simple Test Scene' example.
Original (DEPRECATED - lines 48-74):
mcrfpy.createScene("test")
grid = mcrfpy.Grid(20, 15, texture, (10, 10), (800, 600))
ui = mcrfpy.sceneUI("test")
mcrfpy.setScene("test")
mcrfpy.keypressScene(move_around)
Modern equivalent below.
"""
import mcrfpy
from mcrfpy import automation
import sys
# Create scene using modern API
scene = mcrfpy.Scene("test")
scene.activate()
mcrfpy.step(0.01) # Initialize
# Load texture
texture = mcrfpy.Texture("assets/kenney_tinydungeon.png", 16, 16)
# Create grid using modern keyword API
grid = mcrfpy.Grid(
grid_size=(20, 15),
texture=texture,
pos=(10, 10),
size=(800, 600)
)
# Add to scene's children (not sceneUI)
scene.children.append(grid)
# Add keyboard controls using modern API
def move_around(key, state):
if state == "start":
print(f"You pressed {key}")
scene.on_key = move_around
# Render and screenshot
mcrfpy.step(0.1)
automation.screenshot("/opt/goblincorps/repos/McRogueFace/tests/docs/screenshots/quickstart_simple_scene.png")
print("PASS - quickstart simple scene")
sys.exit(0)