ouroboros/android/tests/test_accessibility_adapter.py
Ouroboros cc88a32090 Qualify experimental Android delivery without blocking desktop releases
Select emulator coverage from Android changes and tags, retain observed Android build and verification outcomes, and publish only proof-accepted artifacts. Keep the seven desktop assets mandatory while excluding any incomplete or unverified Android pair. Make existing native labels English, link the recorded capability follow-ups, and align inherited tests with typed delegation and UTF-8 reads. Global function-count debt remains disclosed pending the owner decision.
2026-09-18 02:10:23 +03:00

34 lines
1.5 KiB
Python

"""Focused source contracts for the opt-in accessibility adapter."""
from pathlib import Path
import unittest
HOST = Path(__file__).resolve().parents[1] / "host"
SERVICE = HOST / "src/ai/ouroboros/android/OuroborosAccessibilityService.java"
CONFIG = HOST / "res/xml/accessibility_service_config.xml"
class AccessibilityAdapterTest(unittest.TestCase):
def test_service_exposes_bounded_snapshot_and_stable_snapshot_addresses(self):
source = SERVICE.read_text(encoding="utf-8")
for marker in ("max_windows", "max_nodes", "max_depth", "truncation_reason", "node_address", "stale_or_missing_node_address"):
self.assertIn(marker, source)
self.assertIn('"bounded_interactive_window_tree"', source)
self.assertIn("root.recycle()", source)
self.assertIn("child.recycle()", source)
def test_generic_node_actions_and_gesture_have_typed_failure_paths(self):
source = SERVICE.read_text(encoding="utf-8")
for marker in ("ACTION_CLICK", "ACTION_SET_TEXT", "ACTION_SCROLL_FORWARD", "dispatchGesture",
"gesture_result_timeout", "accessibility_not_enabled"):
self.assertIn(marker, source)
def test_service_requests_interactive_windows_and_view_ids(self):
config = CONFIG.read_text(encoding="utf-8")
self.assertIn("flagRetrieveInteractiveWindows", config)
self.assertIn("flagReportViewIds", config)
self.assertIn('android:canRetrieveWindowContent="true"', config)
if __name__ == "__main__":
unittest.main()