McRogueFace/tests
John McCardle 1d11b020b0 Implement Scene subclass on_key callback support
Scene subclasses can now define on_key(self, key, state) methods that
receive keyboard events, matching the existing on_enter, on_exit, and
update lifecycle callbacks.

Changes:
- Rename call_on_keypress to call_on_key (consistent naming with property)
- Add triggerKeyEvent helper in McRFPy_API
- Call triggerKeyEvent from GameEngine when key_callable is not set
- Fix condition to check key_callable.isNone() (not just pointer existence)
- Handle both bound methods and instance-assigned callables

Usage:
    class GameScene(mcrfpy.Scene):
        def on_key(self, key, state):
            if key == "Escape" and state == "end":
                quit_game()

Property assignment (scene.on_key = callable) still works and takes
precedence when key_callable is set via the property setter.

Includes comprehensive test: tests/unit/scene_subclass_on_key_test.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 15:51:20 -05:00
..
benchmarks Timer overhaul: update tests 2026-01-03 22:44:53 -05:00
demo Timer overhaul: update tests 2026-01-03 22:44:53 -05:00
geometry_demo Timer overhaul: update tests 2026-01-03 22:44:53 -05:00
integration Timer overhaul: update tests 2026-01-03 22:44:53 -05:00
notes Timer overhaul: update tests 2026-01-03 22:44:53 -05:00
regression tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
unit Implement Scene subclass on_key callback support 2026-01-09 15:51:20 -05:00
vllm_demo update tests: new scene API 2026-01-03 10:59:52 -05:00
api_changes_batch_test.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
issue_176_entity_position_test.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
issue_177_gridpoint_grid_pos_test.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
issue_179_181_grid_vectors_test.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
issue_180_timer_orphan_test.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
issue_180_timer_stopped_test.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
issue_182_caption_size_test.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
issue_184_189_module_test.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
issue_185_188_bounds_test.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
issue_190_layer_docs_test.py Expand TileLayer and ColorLayer __init__ documentation; closes #190 2026-01-05 22:24:36 -05:00
minimal_reparent.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
minimal_test.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
run_tests.py refactor: comprehensive test suite overhaul and demo system 2025-11-25 23:37:05 -05:00
test_append.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
test_callback_vector.py Positions are always mcrfpy.Vector, Vector/tuple/iterables expected as inputs, and for position-only inputs we permit x,y args to prevent requiring double-parens 2026-01-05 10:16:16 -05:00
test_caption_size.py Python API improvements: Vectors, bounds, window singleton, hidden types 2026-01-05 23:00:48 -05:00
test_children.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
test_frame_bounds.py Python API improvements: Vectors, bounds, window singleton, hidden types 2026-01-05 23:00:48 -05:00
test_grid_features.py Python API improvements: Vectors, bounds, window singleton, hidden types 2026-01-05 23:00:48 -05:00
test_gridpoint_debug.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
test_gridpoint_grid_pos.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
test_iter_flush.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
test_iter_only.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
test_iteration.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
test_layer_docs.py Python API improvements: Vectors, bounds, window singleton, hidden types 2026-01-05 23:00:48 -05:00
test_module_namespace.py Python API improvements: Vectors, bounds, window singleton, hidden types 2026-01-05 23:00:48 -05:00
test_module_simple.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
test_scene_create.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00