update tests: new scene API

This commit is contained in:
John McCardle 2026-01-03 10:59:52 -05:00
commit 838da4571d
142 changed files with 616 additions and 601 deletions

View file

@ -181,8 +181,8 @@ if __name__ == "__main__":
print("Issue #123: Grid Sub-grid Chunk System Test")
print("=" * 60)
mcrfpy.createScene("test")
mcrfpy.setScene("test")
test = mcrfpy.Scene("test")
test.activate()
# Run tests after scene is active
mcrfpy.setTimer("test", run_test, 100)

View file

@ -20,8 +20,8 @@ def run_test(runtime):
print("=" * 60)
# Create a test grid
mcrfpy.createScene("test")
ui = mcrfpy.sceneUI("test")
test = mcrfpy.Scene("test")
ui = test.children
texture = mcrfpy.Texture("assets/kenney_ice.png", 16, 16)
grid = mcrfpy.Grid(pos=(0,0), size=(400,300), grid_size=(50, 50), texture=texture)
@ -109,6 +109,6 @@ def run_test(runtime):
sys.exit(0)
# Initialize and run
mcrfpy.createScene("init")
mcrfpy.setScene("init")
init = mcrfpy.Scene("init")
init.activate()
mcrfpy.setTimer("test", run_test, 100)

View file

@ -17,8 +17,8 @@ def run_test(runtime):
print("=" * 60)
# Create test scene
mcrfpy.createScene("test")
ui = mcrfpy.sceneUI("test")
test = mcrfpy.Scene("test")
ui = test.children
texture = mcrfpy.Texture("assets/kenney_ice.png", 16, 16)
# Create grid with explicit empty layers (#150 migration)
@ -188,6 +188,6 @@ def run_test(runtime):
sys.exit(0)
# Initialize and run
mcrfpy.createScene("init")
mcrfpy.setScene("init")
init = mcrfpy.Scene("init")
init.activate()
mcrfpy.setTimer("test", run_test, 100)

View file

@ -20,14 +20,14 @@ def run_test(runtime):
print("=" * 60)
# Create test scene
mcrfpy.createScene("test")
ui = mcrfpy.sceneUI("test")
test = mcrfpy.Scene("test")
ui = test.children
texture = mcrfpy.Texture("assets/kenney_ice.png", 16, 16)
# Create grid with larger size for performance testing
grid = mcrfpy.Grid(pos=(50, 50), size=(500, 400), grid_size=(50, 40), texture=texture)
ui.append(grid)
mcrfpy.setScene("test")
test.activate()
print("\n--- Test 1: Layer creation (starts dirty) ---")
color_layer = grid.add_layer("color", z_index=-1)
@ -106,7 +106,7 @@ def run_test(runtime):
# First render will be slow (cache miss)
start = time.time()
mcrfpy.setScene("test") # Force render
test.activate() # Force render
first_render = time.time() - start
print(f" First render (cache build): {first_render*1000:.2f}ms")
@ -152,6 +152,6 @@ def run_test(runtime):
sys.exit(0)
# Initialize and run
mcrfpy.createScene("init")
mcrfpy.setScene("init")
init = mcrfpy.Scene("init")
init.activate()
mcrfpy.setTimer("test", run_test, 100)

View file

@ -15,7 +15,7 @@ print(f"Current working directory: {os.getcwd()}")
print(f"Script location: {__file__}")
# Create a simple scene to verify everything is working
mcrfpy.createScene("issue37_test")
issue37_test = mcrfpy.Scene("issue37_test")
print("PASS: Issue #37 - Script loading working correctly")
sys.exit(0)

View file

@ -27,7 +27,7 @@ def test_script_loading():
test_script = """
import mcrfpy
print("TEST SCRIPT LOADED SUCCESSFULLY")
mcrfpy.createScene("test_scene")
test_scene = mcrfpy.Scene("test_scene")
"""
# Save the original game.py

View file

@ -81,8 +81,8 @@ def run_test(runtime):
sys.exit(0)
# Set up the test scene
mcrfpy.createScene("test")
mcrfpy.setScene("test")
test = mcrfpy.Scene("test")
test.activate()
# Schedule test to run after game loop starts
mcrfpy.setTimer("test", run_test, 100)

View file

@ -163,8 +163,8 @@ def run_test(runtime):
sys.exit(0)
# Set up the test scene
mcrfpy.createScene("test")
mcrfpy.setScene("test")
test = mcrfpy.Scene("test")
test.activate()
# Schedule test to run after game loop starts
mcrfpy.setTimer("test", run_test, 100)

View file

@ -217,8 +217,8 @@ def run_test(runtime):
sys.exit(0)
# Set up the test scene
mcrfpy.createScene("test")
mcrfpy.setScene("test")
test = mcrfpy.Scene("test")
test.activate()
# Schedule test to run after game loop starts
mcrfpy.setTimer("test", run_test, 100)

View file

@ -21,7 +21,7 @@ def run_test(runtime):
grid.h = 300
# Add to scene
scene_ui = mcrfpy.sceneUI("test")
scene_ui = test.children
scene_ui.append(grid)
# Test accessing grid points
@ -60,8 +60,8 @@ def run_test(runtime):
sys.exit(0)
# Create and set scene
mcrfpy.createScene("test")
mcrfpy.setScene("test")
test = mcrfpy.Scene("test")
test.activate()
# Schedule test
mcrfpy.setTimer("test", run_test, 100)

View file

@ -45,7 +45,7 @@ def test_rendertexture_resize():
"""Test RenderTexture behavior with various grid sizes"""
print("=== Testing UIGrid RenderTexture Resize (Issue #9) ===\n")
scene_ui = mcrfpy.sceneUI("test")
scene_ui = test.children
# Test 1: Small grid (should work fine)
print("--- Test 1: Small Grid (400x300) ---")
@ -222,8 +222,8 @@ def run_test(runtime):
sys.exit(0)
# Set up the test scene
mcrfpy.createScene("test")
mcrfpy.setScene("test")
test = mcrfpy.Scene("test")
test.activate()
# Schedule test to run after game loop starts
mcrfpy.setTimer("test", run_test, 100)

View file

@ -20,7 +20,7 @@ def run_test(runtime):
grid.h = 200
# Add grid to scene
scene_ui = mcrfpy.sceneUI("test")
scene_ui = test.children
scene_ui.append(grid)
# Take initial screenshot
@ -82,8 +82,8 @@ def run_test(runtime):
sys.exit(0)
# Set up the test scene
mcrfpy.createScene("test")
mcrfpy.setScene("test")
test = mcrfpy.Scene("test")
test.activate()
# Schedule test to run after game loop starts
mcrfpy.setTimer("test", run_test, 100)

View file

@ -78,6 +78,6 @@ def run_test(runtime):
sys.exit(0)
# Set up scene and run
mcrfpy.createScene("test")
mcrfpy.setScene("test")
test = mcrfpy.Scene("test")
test.activate()
mcrfpy.setTimer("test", run_test, 100)