# {py:mod}`simvx.core.testing` ```{py:module} simvx.core.testing ``` ```{autodoc2-docstring} simvx.core.testing :allowtitles: ``` ## Module Contents ### Classes ````{list-table} :class: autosummary longtable :align: left * - {py:obj}`SceneRunner ` - ```{autodoc2-docstring} simvx.core.testing.SceneRunner :summary: ``` * - {py:obj}`InputSimulator ` - ```{autodoc2-docstring} simvx.core.testing.InputSimulator :summary: ``` * - {py:obj}`NodeCounter ` - ```{autodoc2-docstring} simvx.core.testing.NodeCounter :summary: ``` * - {py:obj}`FrameTimer ` - ```{autodoc2-docstring} simvx.core.testing.FrameTimer :summary: ``` * - {py:obj}`RecordedEvent ` - ```{autodoc2-docstring} simvx.core.testing.RecordedEvent :summary: ``` * - {py:obj}`TestRecorder ` - ```{autodoc2-docstring} simvx.core.testing.TestRecorder :summary: ``` ```` ### Functions ````{list-table} :class: autosummary longtable :align: left * - {py:obj}`scene_diff ` - ```{autodoc2-docstring} simvx.core.testing.scene_diff :summary: ``` * - {py:obj}`scene_describe ` - ```{autodoc2-docstring} simvx.core.testing.scene_describe :summary: ``` * - {py:obj}`ui_describe ` - ```{autodoc2-docstring} simvx.core.testing.ui_describe :summary: ``` ```` ### Data ````{list-table} :class: autosummary longtable :align: left * - {py:obj}`__all__ ` - ```{autodoc2-docstring} simvx.core.testing.__all__ :summary: ``` ```` ### API ````{py:data} __all__ :canonical: simvx.core.testing.__all__ :value: > ['SceneRunner', 'InputSimulator', 'scene_diff', 'NodeCounter', 'FrameTimer', 'scene_describe', 'ui_d... ```{autodoc2-docstring} simvx.core.testing.__all__ ``` ```` `````{py:class} SceneRunner(screen_size: tuple[float, float] = (800, 600)) :canonical: simvx.core.testing.SceneRunner ```{autodoc2-docstring} simvx.core.testing.SceneRunner ``` ```{rubric} Initialization ``` ```{autodoc2-docstring} simvx.core.testing.SceneRunner.__init__ ``` ````{py:method} load(root_node: simvx.core.engine.Node) -> simvx.core.testing.SceneRunner :canonical: simvx.core.testing.SceneRunner.load ```{autodoc2-docstring} simvx.core.testing.SceneRunner.load ``` ```` ````{py:method} advance_frames(count: int = 1, dt: float | None = None, draw: bool = False) -> simvx.core.testing.SceneRunner :canonical: simvx.core.testing.SceneRunner.advance_frames ```{autodoc2-docstring} simvx.core.testing.SceneRunner.advance_frames ``` ```` ````{py:method} advance_time(seconds: float, dt: float | None = None) -> simvx.core.testing.SceneRunner :canonical: simvx.core.testing.SceneRunner.advance_time ```{autodoc2-docstring} simvx.core.testing.SceneRunner.advance_time ``` ```` ````{py:method} find(name_or_type, recursive: bool = True) -> simvx.core.engine.Node | None :canonical: simvx.core.testing.SceneRunner.find ```{autodoc2-docstring} simvx.core.testing.SceneRunner.find ``` ```` ````{py:method} find_all(node_type: type) -> list[simvx.core.engine.Node] :canonical: simvx.core.testing.SceneRunner.find_all ```{autodoc2-docstring} simvx.core.testing.SceneRunner.find_all ``` ```` ````{py:property} root :canonical: simvx.core.testing.SceneRunner.root :type: simvx.core.engine.Node | None ```{autodoc2-docstring} simvx.core.testing.SceneRunner.root ``` ```` ````{py:property} frame_count :canonical: simvx.core.testing.SceneRunner.frame_count :type: int ```{autodoc2-docstring} simvx.core.testing.SceneRunner.frame_count ``` ```` ````{py:property} elapsed_time :canonical: simvx.core.testing.SceneRunner.elapsed_time :type: float ```{autodoc2-docstring} simvx.core.testing.SceneRunner.elapsed_time ``` ```` ````{py:method} snapshot() -> dict :canonical: simvx.core.testing.SceneRunner.snapshot ```{autodoc2-docstring} simvx.core.testing.SceneRunner.snapshot ``` ```` ````` `````{py:class} InputSimulator :canonical: simvx.core.testing.InputSimulator ```{autodoc2-docstring} simvx.core.testing.InputSimulator ``` ````{py:method} press_key(key) -> None :canonical: simvx.core.testing.InputSimulator.press_key ```{autodoc2-docstring} simvx.core.testing.InputSimulator.press_key ``` ```` ````{py:method} release_key(key) -> None :canonical: simvx.core.testing.InputSimulator.release_key ```{autodoc2-docstring} simvx.core.testing.InputSimulator.release_key ``` ```` ````{py:method} tap_key(key) -> None :canonical: simvx.core.testing.InputSimulator.tap_key ```{autodoc2-docstring} simvx.core.testing.InputSimulator.tap_key ``` ```` ````{py:method} press_mouse(button: int = 1, position: tuple[float, float] | None = None) -> None :canonical: simvx.core.testing.InputSimulator.press_mouse ```{autodoc2-docstring} simvx.core.testing.InputSimulator.press_mouse ``` ```` ````{py:method} release_mouse(button: int = 1) -> None :canonical: simvx.core.testing.InputSimulator.release_mouse ```{autodoc2-docstring} simvx.core.testing.InputSimulator.release_mouse ``` ```` ````{py:method} click(position: tuple[float, float], button: int = 1) -> None :canonical: simvx.core.testing.InputSimulator.click ```{autodoc2-docstring} simvx.core.testing.InputSimulator.click ``` ```` ````{py:method} move_mouse(x: float, y: float) -> None :canonical: simvx.core.testing.InputSimulator.move_mouse ```{autodoc2-docstring} simvx.core.testing.InputSimulator.move_mouse ``` ```` ````{py:method} scroll(dx: float = 0.0, dy: float = -1.0) -> None :canonical: simvx.core.testing.InputSimulator.scroll ```{autodoc2-docstring} simvx.core.testing.InputSimulator.scroll ``` ```` ````{py:method} reset() -> None :canonical: simvx.core.testing.InputSimulator.reset ```{autodoc2-docstring} simvx.core.testing.InputSimulator.reset ``` ```` ````` ````{py:function} scene_diff(before: dict, after: dict, _path: str = '') -> list[str] :canonical: simvx.core.testing.scene_diff ```{autodoc2-docstring} simvx.core.testing.scene_diff ``` ```` `````{py:class} NodeCounter :canonical: simvx.core.testing.NodeCounter ```{autodoc2-docstring} simvx.core.testing.NodeCounter ``` ````{py:method} count(root: simvx.core.engine.Node) -> dict[str, int] :canonical: simvx.core.testing.NodeCounter.count :staticmethod: ```{autodoc2-docstring} simvx.core.testing.NodeCounter.count ``` ```` ````{py:method} total(root: simvx.core.engine.Node) -> int :canonical: simvx.core.testing.NodeCounter.total :staticmethod: ```{autodoc2-docstring} simvx.core.testing.NodeCounter.total ``` ```` ````` `````{py:class} FrameTimer() :canonical: simvx.core.testing.FrameTimer ```{autodoc2-docstring} simvx.core.testing.FrameTimer ``` ```{rubric} Initialization ``` ```{autodoc2-docstring} simvx.core.testing.FrameTimer.__init__ ``` ````{py:method} begin_frame() -> None :canonical: simvx.core.testing.FrameTimer.begin_frame ```{autodoc2-docstring} simvx.core.testing.FrameTimer.begin_frame ``` ```` ````{py:method} end_frame() -> None :canonical: simvx.core.testing.FrameTimer.end_frame ```{autodoc2-docstring} simvx.core.testing.FrameTimer.end_frame ``` ```` ````{py:property} average_ms :canonical: simvx.core.testing.FrameTimer.average_ms :type: float ```{autodoc2-docstring} simvx.core.testing.FrameTimer.average_ms ``` ```` ````{py:property} max_ms :canonical: simvx.core.testing.FrameTimer.max_ms :type: float ```{autodoc2-docstring} simvx.core.testing.FrameTimer.max_ms ``` ```` ````{py:property} min_ms :canonical: simvx.core.testing.FrameTimer.min_ms :type: float ```{autodoc2-docstring} simvx.core.testing.FrameTimer.min_ms ``` ```` ````{py:property} fps :canonical: simvx.core.testing.FrameTimer.fps :type: float ```{autodoc2-docstring} simvx.core.testing.FrameTimer.fps ``` ```` ````{py:property} frame_count :canonical: simvx.core.testing.FrameTimer.frame_count :type: int ```{autodoc2-docstring} simvx.core.testing.FrameTimer.frame_count ``` ```` ````{py:method} reset() -> None :canonical: simvx.core.testing.FrameTimer.reset ```{autodoc2-docstring} simvx.core.testing.FrameTimer.reset ``` ```` ````` ````{py:function} scene_describe(root: simvx.core.engine.Node, include_properties: bool = True, include_layout: bool = True) -> str :canonical: simvx.core.testing.scene_describe ```{autodoc2-docstring} simvx.core.testing.scene_describe ``` ```` ````{py:function} ui_describe(root, include_layout: bool = True) -> str :canonical: simvx.core.testing.ui_describe ```{autodoc2-docstring} simvx.core.testing.ui_describe ``` ```` `````{py:class} RecordedEvent :canonical: simvx.core.testing.RecordedEvent ```{autodoc2-docstring} simvx.core.testing.RecordedEvent ``` ````{py:attribute} timestamp :canonical: simvx.core.testing.RecordedEvent.timestamp :type: float :value: > None ```{autodoc2-docstring} simvx.core.testing.RecordedEvent.timestamp ``` ```` ````{py:attribute} event_type :canonical: simvx.core.testing.RecordedEvent.event_type :type: str :value: > None ```{autodoc2-docstring} simvx.core.testing.RecordedEvent.event_type ``` ```` ````{py:attribute} x :canonical: simvx.core.testing.RecordedEvent.x :type: float :value: > 0.0 ```{autodoc2-docstring} simvx.core.testing.RecordedEvent.x ``` ```` ````{py:attribute} y :canonical: simvx.core.testing.RecordedEvent.y :type: float :value: > 0.0 ```{autodoc2-docstring} simvx.core.testing.RecordedEvent.y ``` ```` ````{py:attribute} button :canonical: simvx.core.testing.RecordedEvent.button :type: int :value: > 0 ```{autodoc2-docstring} simvx.core.testing.RecordedEvent.button ``` ```` ````{py:attribute} key :canonical: simvx.core.testing.RecordedEvent.key :type: str :value: ```{autodoc2-docstring} simvx.core.testing.RecordedEvent.key ``` ```` ````{py:attribute} char :canonical: simvx.core.testing.RecordedEvent.char :type: str :value: ```{autodoc2-docstring} simvx.core.testing.RecordedEvent.char ``` ```` ````{py:attribute} target_path :canonical: simvx.core.testing.RecordedEvent.target_path :type: str :value: ```{autodoc2-docstring} simvx.core.testing.RecordedEvent.target_path ``` ```` ````` `````{py:class} TestRecorder(format: str = 'harness', **kwargs) :canonical: simvx.core.testing.TestRecorder Bases: {py:obj}`simvx.core.engine.Node` ```{autodoc2-docstring} simvx.core.testing.TestRecorder ``` ```{rubric} Initialization ``` ```{autodoc2-docstring} simvx.core.testing.TestRecorder.__init__ ``` ````{py:attribute} format :canonical: simvx.core.testing.TestRecorder.format :type: str :value: > 'harness' ```{autodoc2-docstring} simvx.core.testing.TestRecorder.format ``` ```` ````{py:method} start_recording() -> None :canonical: simvx.core.testing.TestRecorder.start_recording ```{autodoc2-docstring} simvx.core.testing.TestRecorder.start_recording ``` ```` ````{py:method} stop_recording() -> str :canonical: simvx.core.testing.TestRecorder.stop_recording ```{autodoc2-docstring} simvx.core.testing.TestRecorder.stop_recording ``` ```` ````{py:method} save_recording(path: pathlib.Path, format: str | None = None) -> None :canonical: simvx.core.testing.TestRecorder.save_recording ```{autodoc2-docstring} simvx.core.testing.TestRecorder.save_recording ``` ```` ````{py:property} is_recording :canonical: simvx.core.testing.TestRecorder.is_recording :type: bool ```{autodoc2-docstring} simvx.core.testing.TestRecorder.is_recording ``` ```` ````{py:property} event_count :canonical: simvx.core.testing.TestRecorder.event_count :type: int ```{autodoc2-docstring} simvx.core.testing.TestRecorder.event_count ``` ```` ````{py:method} record_event(event: simvx.core.testing.RecordedEvent) -> None :canonical: simvx.core.testing.TestRecorder.record_event ```{autodoc2-docstring} simvx.core.testing.TestRecorder.record_event ``` ```` ````{py:method} process(dt: float) -> None :canonical: simvx.core.testing.TestRecorder.process ```` ````{py:attribute} script_error_raised :canonical: simvx.core.testing.TestRecorder.script_error_raised :value: > 'Signal(...)' ```` ````{py:method} __init_subclass__(**kwargs) :canonical: simvx.core.testing.TestRecorder.__init_subclass__ :classmethod: ```` ````{py:property} name :canonical: simvx.core.testing.TestRecorder.name :type: str ```` ````{py:property} process_mode :canonical: simvx.core.testing.TestRecorder.process_mode :type: simvx.core.descriptors.ProcessMode ```` ````{py:method} reset_error() -> None :canonical: simvx.core.testing.TestRecorder.reset_error ```` ````{py:method} add_child(node: simvx.core.node.Node) -> simvx.core.node.Node :canonical: simvx.core.testing.TestRecorder.add_child ```` ````{py:method} remove_child(node: simvx.core.node.Node) :canonical: simvx.core.testing.TestRecorder.remove_child ```` ````{py:method} reparent(new_parent: simvx.core.node.Node) :canonical: simvx.core.testing.TestRecorder.reparent ```` ````{py:method} get_node(path: str) -> simvx.core.node.Node :canonical: simvx.core.testing.TestRecorder.get_node ```` ````{py:method} find_child(name: str, recursive: bool = False) -> simvx.core.node.Node | None :canonical: simvx.core.testing.TestRecorder.find_child ```` ````{py:method} find(node_type: type) -> simvx.core.node.Node | None :canonical: simvx.core.testing.TestRecorder.find ```` ````{py:method} find_all(node_type: type, recursive: bool = True) -> list :canonical: simvx.core.testing.TestRecorder.find_all ```` ````{py:property} path :canonical: simvx.core.testing.TestRecorder.path :type: str ```` ````{py:method} add_to_group(group: str) :canonical: simvx.core.testing.TestRecorder.add_to_group ```` ````{py:method} remove_from_group(group: str) :canonical: simvx.core.testing.TestRecorder.remove_from_group ```` ````{py:method} is_in_group(group: str) -> bool :canonical: simvx.core.testing.TestRecorder.is_in_group ```` ````{py:method} ready() -> None :canonical: simvx.core.testing.TestRecorder.ready ```` ````{py:method} enter_tree() -> None :canonical: simvx.core.testing.TestRecorder.enter_tree ```` ````{py:method} exit_tree() -> None :canonical: simvx.core.testing.TestRecorder.exit_tree ```` ````{py:method} physics_process(dt: float) -> None :canonical: simvx.core.testing.TestRecorder.physics_process ```` ````{py:method} draw(renderer) -> None :canonical: simvx.core.testing.TestRecorder.draw ```` ````{py:method} input_event(event: simvx.core.events.InputEvent) -> None :canonical: simvx.core.testing.TestRecorder.input_event ```` ````{py:method} input(event: simvx.core.events.TreeInputEvent) -> None :canonical: simvx.core.testing.TestRecorder.input ```` ````{py:method} unhandled_input(event: simvx.core.events.TreeInputEvent) -> None :canonical: simvx.core.testing.TestRecorder.unhandled_input ```` ````{py:method} start_coroutine(gen: simvx.core.descriptors.Coroutine) -> simvx.core.descriptors.CoroutineHandle :canonical: simvx.core.testing.TestRecorder.start_coroutine ```` ````{py:method} stop_coroutine(gen_or_handle) :canonical: simvx.core.testing.TestRecorder.stop_coroutine ```` ````{py:method} destroy() :canonical: simvx.core.testing.TestRecorder.destroy ```` ````{py:attribute} queue_free :canonical: simvx.core.testing.TestRecorder.queue_free :value: > None ```` ````{py:property} tree :canonical: simvx.core.testing.TestRecorder.tree :type: simvx.core.scene_tree.SceneTree ```` ````{py:method} get_tree() -> simvx.core.scene_tree.SceneTree :canonical: simvx.core.testing.TestRecorder.get_tree ```` ````{py:method} __getitem__(key: str) :canonical: simvx.core.testing.TestRecorder.__getitem__ ```` ````{py:method} get_properties() -> dict[str, simvx.core.descriptors.Property] :canonical: simvx.core.testing.TestRecorder.get_properties :classmethod: ```` ````{py:attribute} get_settings :canonical: simvx.core.testing.TestRecorder.get_settings :value: > None ```` ````{py:method} __repr__() :canonical: simvx.core.testing.TestRecorder.__repr__ ```` `````