Add autofocus mode.

This commit is contained in:
Storm Dragon committed 2026-10-28 22:06:04 -04:00
1 parent b232c1eebb
commit 3e2429b8a5
19 files changed
+279 -8

No files matched your search

+25 -1
View File
@@ -706,7 +706,7 @@ def inside():
assert process.wait(timeout=5) == 0, "successful OK did not close"
print("PASS: repeated Apply restores button focus, passive success status, focused rejection, OK closes")
return
if application:
if application and os.environ.get("CTHULHU_PREFS_STRUCTURAL_FOCUS_ONLY") != "1":
focus(named("Desktop"))
key("Right")
wait_for(lambda: named("Laptop").getState().contains(pyatspi.STATE_CHECKED), "application preferences keyboard layout could not be changed")
@@ -951,6 +951,30 @@ def inside():
assert responses.read_remaining() == "", "Escape submitted changes"
print("PASS: synthesizer and voice previews, locale filtering, language preserved across synthesizers, Apply/reload, dropdown and window Escape")
return
if os.environ.get("CTHULHU_PREFS_STRUCTURAL_FOCUS_ONLY") == "1":
checkbox = named("Automatic focus mode during structural navigation")
assert checkbox.getRole() == pyatspi.ROLE_CHECK_BOX
assert not checkbox.getState().contains(pyatspi.STATE_CHECKED)
focus(checkbox)
key("Tab")
wait_for(lambda: not checkbox.getState().contains(pyatspi.STATE_FOCUSED), "Tab did not leave automatic focus checkbox")
key("shift+Tab")
wait_for(lambda: checkbox.getState().contains(pyatspi.STATE_FOCUSED), "Shift+Tab did not return to automatic focus checkbox")
for enabled in (True, False):
key("space")
wait_for(lambda: checkbox.getState().contains(pyatspi.STATE_CHECKED) == enabled, "automatic focus checkbox did not toggle")
focus(named("Apply")); key("space")
applied = request()
assert applied["Values"]["StructuralNavigationTriggersFocusMode"] == enabled, applied
send(dict(initial, Values=applied["Values"], Message="Preferences saved."))
wait_for(lambda: named("Apply").getState().contains(pyatspi.STATE_SENSITIVE), "Apply busy")
assert checkbox.getState().contains(pyatspi.STATE_CHECKED) == enabled
focus(checkbox)
focus(named("Cancel")); key("space")
assert process.wait(timeout=5) == 0
assert responses.read_remaining() == "", "Cancel submitted changes"
print("PASS: automatic structural focus checkbox, default, Tab/Shift+Tab, enable/disable, Apply/reload, Cancel")
return
if os.environ.get("CTHULHU_PREFS_READING_ONLY") == "1":
focus(named("Desktop"))
for page in ("Sounds", "Speech"):