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

@ -158,7 +158,7 @@ def test_edge_cases():
print(" Edge cases: PASS")
return True
def run_test(runtime):
def run_test(timer, runtime):
"""Timer callback to run tests after scene is active"""
results = []
@ -185,4 +185,4 @@ if __name__ == "__main__":
test.activate()
# Run tests after scene is active
mcrfpy.setTimer("test", run_test, 100)
test_timer = mcrfpy.Timer("test", run_test, 100, once=True)

View file

@ -14,7 +14,7 @@ import mcrfpy
import sys
import time
def run_test(runtime):
def run_test(timer, runtime):
print("=" * 60)
print("Issue #146 Regression Test: compute_fov() returns None")
print("=" * 60)
@ -111,4 +111,4 @@ def run_test(runtime):
# Initialize and run
init = mcrfpy.Scene("init")
init.activate()
mcrfpy.setTimer("test", run_test, 100)
test_timer = mcrfpy.Timer("test", run_test, 100, once=True)

View file

@ -11,7 +11,7 @@ Tests:
import mcrfpy
import sys
def run_test(runtime):
def run_test(timer, runtime):
print("=" * 60)
print("Issue #147 Regression Test: Dynamic Layer System for Grid")
print("=" * 60)
@ -190,4 +190,4 @@ def run_test(runtime):
# Initialize and run
init = mcrfpy.Scene("init")
init.activate()
mcrfpy.setTimer("test", run_test, 100)
test_timer = mcrfpy.Timer("test", run_test, 100, once=True)

View file

@ -14,7 +14,7 @@ import mcrfpy
import sys
import time
def run_test(runtime):
def run_test(timer, runtime):
print("=" * 60)
print("Issue #148 Regression Test: Layer Dirty Flags and Caching")
print("=" * 60)
@ -154,4 +154,4 @@ def run_test(runtime):
# Initialize and run
init = mcrfpy.Scene("init")
init.activate()
mcrfpy.setTimer("test", run_test, 100)
test_timer = mcrfpy.Timer("test", run_test, 100, once=True)

View file

@ -17,7 +17,7 @@ class CustomEntity(mcrfpy.Entity):
def custom_method(self):
return "Custom method called"
def run_test(runtime):
def run_test(timer, runtime):
"""Test that derived entity classes maintain their type in collections"""
try:
# Create a grid
@ -85,4 +85,4 @@ test = mcrfpy.Scene("test")
test.activate()
# Schedule test to run after game loop starts
mcrfpy.setTimer("test", run_test, 100)
test_timer = mcrfpy.Timer("test", run_test, 100, once=True)

View file

@ -149,7 +149,7 @@ def test_color_properties():
return tests_passed == tests_total
def run_test(runtime):
def run_test(timer, runtime):
"""Timer callback to run the test"""
try:
success = test_color_properties()
@ -167,4 +167,4 @@ test = mcrfpy.Scene("test")
test.activate()
# Schedule test to run after game loop starts
mcrfpy.setTimer("test", run_test, 100)
test_timer = mcrfpy.Timer("test", run_test, 100, once=True)

View file

@ -183,7 +183,7 @@ def test_property_introspection():
return tests_passed, tests_total
def run_test(runtime):
def run_test(timer, runtime):
"""Timer callback to run the test"""
try:
print("=== Testing Texture and Font Properties (Issue #99) ===\n")
@ -221,4 +221,4 @@ test = mcrfpy.Scene("test")
test.activate()
# Schedule test to run after game loop starts
mcrfpy.setTimer("test", run_test, 100)
test_timer = mcrfpy.Timer("test", run_test, 100, once=True)

View file

@ -7,7 +7,7 @@ import mcrfpy
from mcrfpy import automation
import sys
def run_test(runtime):
def run_test(timer, runtime):
"""Test RenderTexture resizing"""
print("Testing Issue #9: RenderTexture resize (minimal)")
@ -64,4 +64,4 @@ test = mcrfpy.Scene("test")
test.activate()
# Schedule test
mcrfpy.setTimer("test", run_test, 100)
test_timer = mcrfpy.Timer("test", run_test, 100, once=True)

View file

@ -209,7 +209,7 @@ def test_rendertexture_resize():
print(f"\nScreenshots saved to /tmp/issue_9_*.png")
def run_test(runtime):
def run_test(timer, runtime):
"""Timer callback to run the test"""
try:
test_rendertexture_resize()
@ -226,4 +226,4 @@ test = mcrfpy.Scene("test")
test.activate()
# Schedule test to run after game loop starts
mcrfpy.setTimer("test", run_test, 100)
test_timer = mcrfpy.Timer("test", run_test, 100, once=True)

View file

@ -9,7 +9,7 @@ import mcrfpy
from mcrfpy import automation
import sys
def run_test(runtime):
def run_test(timer, runtime):
"""Test that UIGrid properly handles resizing"""
try:
# Create a grid with initial size
@ -86,4 +86,4 @@ test = mcrfpy.Scene("test")
test.activate()
# Schedule test to run after game loop starts
mcrfpy.setTimer("test", run_test, 100)
test_timer = mcrfpy.Timer("test", run_test, 100, once=True)

View file

@ -64,7 +64,7 @@ def demonstrate_solution():
}
""")
def run_test(runtime):
def run_test(timer, runtime):
"""Timer callback"""
try:
demonstrate_solution()
@ -74,10 +74,10 @@ def run_test(runtime):
print(f"\nError: {e}")
import traceback
traceback.print_exc()
sys.exit(0)
# Set up scene and run
test = mcrfpy.Scene("test")
test.activate()
mcrfpy.setTimer("test", run_test, 100)
test_timer = mcrfpy.Timer("test", run_test, 100, once=True)