Timer overhaul: update tests

This commit is contained in:
John McCardle 2026-01-03 22:44:53 -05:00
commit cec76b63dc
78 changed files with 521 additions and 495 deletions

View file

@ -1,26 +1,28 @@
#!/usr/bin/env python3
"""
Test legacy timer API still works
Test Timer API works correctly (#173)
Replaces old legacy setTimer test
"""
import mcrfpy
import sys
count = 0
def timer_callback(runtime):
def timer_callback(timer, runtime):
global count
count += 1
print(f"Timer fired! Count: {count}, Runtime: {runtime}")
if count >= 3:
print("Test passed - timer fired 3 times")
print("PASS")
sys.exit(0)
# Set up the scene
test_scene = mcrfpy.Scene("test_scene")
test_scene.activate()
# Create a timer the old way
mcrfpy.setTimer("test_timer", timer_callback, 100)
# Create a timer with new API
timer = mcrfpy.Timer("test_timer", timer_callback, 100)
print("Legacy timer test starting...")
print("Timer test starting...")