fix: Update test files to use current API patterns

Migrates test suite to current API:
- Frame(x, y, w, h) → Frame(pos=(x, y), size=(w, h))
- Caption("text", x, y) → Caption(pos=(x, y), text="text")
- caption.size → caption.font_size
- Entity(x, y, ...) → Entity((x, y), ...)
- Grid(w, h, ...) → Grid(grid_size=(w, h), ...)
- cell.color → ColorLayer system

Tests now serve as valid API usage examples.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John McCardle 2025-12-29 19:47:48 -05:00
commit 9f481a2e4a
53 changed files with 614 additions and 586 deletions

View file

@ -282,23 +282,23 @@ def setup_grid_stress():
grid.center = (400, 400) # Center view
ui.append(grid)
# Fill with alternating colors
# Add color layer and fill with alternating colors
color_layer = grid.add_layer("color", z_index=-1)
for y in range(50):
for x in range(50):
cell = grid.at(x, y)
if (x + y) % 2 == 0:
cell.color = mcrfpy.Color(60, 60, 80)
color_layer.set(x, y, mcrfpy.Color(60, 60, 80))
else:
cell.color = mcrfpy.Color(40, 40, 60)
color_layer.set(x, y, mcrfpy.Color(40, 40, 60))
# Add 50 entities
try:
texture = mcrfpy.Texture("assets/kenney_tinydungeon.png", 16, 16)
for i in range(50):
# Entity takes positional args: (position, texture, sprite_index, grid)
pos = mcrfpy.Vector(random.randint(5, 45), random.randint(5, 45))
entity = mcrfpy.Entity(pos, texture, random.randint(0, 100), grid)
# Entity takes tuple position and keyword args
pos = (random.randint(5, 45), random.randint(5, 45))
entity = mcrfpy.Entity(pos, texture=texture, sprite_index=random.randint(0, 100), grid=grid)
grid.entities.append(entity)
except Exception as e:
print(f" Note: Could not create entities: {e}")