"""Loads the extension inside Orca's Python and checks the Orca APIs it uses.""" import inspect, sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from orca import dbus_service, presentation_manager, typing_echo_presenter import wine_access from wine_access import WineAccess ext = WineAccess() assert ext.module_name == "WineAccess" registration = dbus_service._ModuleRegistration.from_module_instance("WineAccess", ext) assert registration.is_empty(), "Orca would publish its own WineAccess object and clash" assert hasattr(ext.controller, "_bus"), "Orca's controller no longer exposes its bus" pm = presentation_manager.get_manager() assert "kill_flash" in inspect.signature(pm.interrupt_presentation).parameters for name in ("present_message", "speak_message", "speak_character", "present_braille_message"): assert callable(getattr(pm, name)), name echo = typing_echo_presenter.get_presenter() for name in ("get_key_echo_enabled", "get_character_echo_enabled", "get_action_keys_enabled", "get_alphabetic_keys_enabled", "get_numeric_keys_enabled", "get_punctuation_keys_enabled"): assert isinstance(getattr(echo, name)(), bool), name print("echo settings: key", echo.get_key_echo_enabled(), "character", echo.get_character_echo_enabled()) print("helper found:", ext._manager.helper) print("PASS: extension loads in Orca 51 and every Orca API it calls exists")