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>
29 lines
No EOL
786 B
Python
29 lines
No EOL
786 B
Python
#!/usr/bin/env python3
|
|
"""Test to verify headless vs windowed mode behavior"""
|
|
|
|
import mcrfpy
|
|
import sys
|
|
|
|
# Create scene
|
|
mcrfpy.createScene("headless_test")
|
|
ui = mcrfpy.sceneUI("headless_test")
|
|
mcrfpy.setScene("headless_test")
|
|
|
|
# Create a visible indicator
|
|
frame = mcrfpy.Frame(pos=(200, 200), size=(400, 200))
|
|
frame.fill_color = mcrfpy.Color(100, 200, 100, 255)
|
|
ui.append(frame)
|
|
|
|
caption = mcrfpy.Caption(pos=(400, 300), text="If you see this, windowed mode is working!")
|
|
caption.font_size = 24
|
|
caption.fill_color = mcrfpy.Color(255, 255, 255)
|
|
ui.append(caption)
|
|
|
|
print("Script started. Window should appear unless --headless was specified.")
|
|
|
|
# Exit after 2 seconds
|
|
def exit_test(runtime):
|
|
print("Test complete. Exiting.")
|
|
sys.exit(0)
|
|
|
|
mcrfpy.setTimer("exit", exit_test, 2000) |