Refactor 11 more tests to mcrfpy.step() pattern
Converted from Timer-based async to step()-based sync: - test_simple_callback.py - test_empty_animation_manager.py - test_frame_clipping.py - test_frame_clipping_advanced.py - test_grid_children.py - test_color_helpers.py - test_no_arg_constructors.py - test_properties_quick.py - test_simple_drawable.py - test_python_object_cache.py - WORKING_automation_test_example.py Only 4 tests remain with Timer-based patterns (2 are headless detection tests that may require special handling). 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Frack <frack@goblincorps.dev> Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
bb86cece2b
commit
be450286f8
12 changed files with 867 additions and 866 deletions
|
|
@ -1,14 +1,32 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Very simple callback test"""
|
||||
"""Very simple callback test - refactored to use mcrfpy.step()"""
|
||||
import mcrfpy
|
||||
import sys
|
||||
|
||||
callback_fired = False
|
||||
|
||||
def cb(a, t):
|
||||
global callback_fired
|
||||
callback_fired = True
|
||||
print("CB")
|
||||
|
||||
# Setup scene
|
||||
test = mcrfpy.Scene("test")
|
||||
test.activate()
|
||||
mcrfpy.step(0.01) # Initialize
|
||||
|
||||
# Create entity and animation
|
||||
e = mcrfpy.Entity((0, 0), texture=None, sprite_index=0)
|
||||
a = mcrfpy.Animation("x", 1.0, 0.1, "linear", callback=cb)
|
||||
a.start(e)
|
||||
mcrfpy.Timer("exit", lambda t, r: sys.exit(0), 200, once=True)
|
||||
|
||||
# Advance past animation duration (0.1s)
|
||||
mcrfpy.step(0.15)
|
||||
|
||||
# Verify callback fired
|
||||
if callback_fired:
|
||||
print("PASS: Callback fired")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print("FAIL: Callback did not fire")
|
||||
sys.exit(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue