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>
60 lines
No EOL
1.8 KiB
Python
60 lines
No EOL
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Test scene transitions in headless mode."""
|
|
|
|
import mcrfpy
|
|
import sys
|
|
|
|
def test_scene_transitions():
|
|
"""Test all scene transition types."""
|
|
|
|
# Create two simple scenes
|
|
print("Creating test scenes...")
|
|
|
|
# Scene 1
|
|
mcrfpy.createScene("scene1")
|
|
ui1 = mcrfpy.sceneUI("scene1")
|
|
frame1 = mcrfpy.Frame(pos=(0, 0), size=(100, 100), fill_color=mcrfpy.Color(255, 0, 0))
|
|
ui1.append(frame1)
|
|
|
|
# Scene 2
|
|
mcrfpy.createScene("scene2")
|
|
ui2 = mcrfpy.sceneUI("scene2")
|
|
frame2 = mcrfpy.Frame(pos=(0, 0), size=(100, 100), fill_color=mcrfpy.Color(0, 0, 255))
|
|
ui2.append(frame2)
|
|
|
|
# Test each transition type
|
|
transitions = [
|
|
("fade", 0.5),
|
|
("slide_left", 0.5),
|
|
("slide_right", 0.5),
|
|
("slide_up", 0.5),
|
|
("slide_down", 0.5),
|
|
(None, 0.0), # Instant
|
|
]
|
|
|
|
print("\nTesting scene transitions:")
|
|
|
|
# Start with scene1
|
|
mcrfpy.setScene("scene1")
|
|
print(f"Initial scene: {mcrfpy.currentScene()}")
|
|
|
|
for trans_type, duration in transitions:
|
|
target = "scene2" if mcrfpy.currentScene() == "scene1" else "scene1"
|
|
|
|
if trans_type:
|
|
print(f"\nTransitioning to {target} with {trans_type} (duration: {duration}s)")
|
|
mcrfpy.setScene(target, trans_type, duration)
|
|
else:
|
|
print(f"\nTransitioning to {target} instantly")
|
|
mcrfpy.setScene(target)
|
|
|
|
print(f"Current scene after transition: {mcrfpy.currentScene()}")
|
|
|
|
print("\n✓ All scene transition types tested successfully!")
|
|
print("\nNote: Visual transitions cannot be verified in headless mode.")
|
|
print("The transitions are implemented and working in the engine.")
|
|
|
|
sys.exit(0)
|
|
|
|
# Run the test immediately
|
|
test_scene_transitions() |