McRogueFace/tests/unit/test_simple_callback.py

32 lines
686 B
Python
Raw Normal View History

#!/usr/bin/env python3
"""Very simple callback test - refactored to use mcrfpy.step()"""
import mcrfpy
import sys
callback_fired = False
def cb(a, t):
global callback_fired
callback_fired = True
print("CB")
# Setup scene
2026-01-03 10:59:52 -05:00
test = mcrfpy.Scene("test")
2026-01-03 22:44:53 -05:00
test.activate()
mcrfpy.step(0.01) # Initialize
# Create entity and animation
e = mcrfpy.Entity((0, 0), texture=None, sprite_index=0)
a = mcrfpy.Animation("x", 1.0, 0.1, "linear", callback=cb)
a.start(e)
# Advance past animation duration (0.1s)
mcrfpy.step(0.15)
# Verify callback fired
if callback_fired:
print("PASS: Callback fired")
sys.exit(0)
else:
print("FAIL: Callback did not fire")
sys.exit(1)