Refactor timing tests to use mcrfpy.step() for synchronous execution
Converts tests from Timer-based async patterns to step()-based sync patterns, eliminating timeout issues in headless testing. Refactored tests: - simple_timer_screenshot_test.py - test_animation_callback_simple.py - test_animation_property_locking.py - test_animation_raii.py - test_animation_removal.py - test_timer_callback.py Also updates KNOWN_ISSUES.md with comprehensive documentation on the step()-based testing pattern including examples and best practices. 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f063d0af0c
commit
4528ece0a7
7 changed files with 325 additions and 290 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test timer callback arguments with new Timer API (#173)
|
||||
Uses mcrfpy.step() for synchronous test execution.
|
||||
"""
|
||||
import mcrfpy
|
||||
import sys
|
||||
|
|
@ -14,9 +15,6 @@ def new_style_callback(timer, runtime):
|
|||
print(f"Callback called with: timer={timer} (type: {type(timer)}), runtime={runtime} (type: {type(runtime)})")
|
||||
if hasattr(timer, 'once'):
|
||||
print(f"Got Timer object! once={timer.once}")
|
||||
if call_count >= 2:
|
||||
print("PASS")
|
||||
sys.exit(0)
|
||||
|
||||
# Set up the scene
|
||||
test_scene = mcrfpy.Scene("test_scene")
|
||||
|
|
@ -25,3 +23,14 @@ test_scene.activate()
|
|||
print("Testing new Timer callback signature (timer, runtime)...")
|
||||
timer = mcrfpy.Timer("test_timer", new_style_callback, 100)
|
||||
print(f"Timer created: {timer}")
|
||||
|
||||
# Advance time to let timer fire - each step() processes timers once
|
||||
mcrfpy.step(0.15) # First fire
|
||||
mcrfpy.step(0.15) # Second fire
|
||||
|
||||
if call_count >= 2:
|
||||
print("PASS: Timer callback received correct arguments")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print(f"FAIL: Expected at least 2 callbacks, got {call_count}")
|
||||
sys.exit(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue