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

@ -4,18 +4,18 @@ import mcrfpy
from mcrfpy import automation
import sys
def take_screenshot(runtime):
def take_screenshot(timer, runtime):
"""Take screenshot after render completes"""
mcrfpy.delTimer("screenshot")
timer.stop()
automation.screenshot("test_grid_children_result.png")
print("Screenshot saved to test_grid_children_result.png")
print("PASS - Grid.children test completed")
sys.exit(0)
def run_test(runtime):
def run_test(timer, runtime):
"""Main test - runs after scene is set up"""
mcrfpy.delTimer("test")
timer.stop()
# Get the scene UI
ui = test.children
@ -119,11 +119,11 @@ def run_test(runtime):
print(f"\nFinal children count: {len(grid.children)}")
# Schedule screenshot for next frame
mcrfpy.setTimer("screenshot", take_screenshot, 100)
mcrfpy.Timer("screenshot", take_screenshot, 100, once=True)
# Create a test scene
test = mcrfpy.Scene("test")
test.activate()
# Schedule test to run after game loop starts
mcrfpy.setTimer("test", run_test, 50)
mcrfpy.Timer("test", run_test, 50, once=True)