Keyboard echo revised with 3 versions.

This commit is contained in:
ak47 committed 2026-10-15 21:54:51 -04:00
1 parent 04e6c08fff
commit 70d447667e
36 files changed
+707 -55

No files matched your search

+1
View File
@@ -88,6 +88,7 @@ def on_key_press(_window, event):
mnemonic_button.grab_focus()
return True
if event.keyval == Gdk.KEY_F10:
indentation_entry.set_editable(not bool(event.state & Gdk.ModifierType.SHIFT_MASK))
indentation_entry.grab_focus()
return True
if event.keyval == Gdk.KEY_F11:
+3 -1
View File
@@ -24,6 +24,7 @@ def run_inside():
return
if os.environ.get("CTHULHU_SPEECH_METADATA") == "1":
run_probe("list")
run_probe("list", echo_focus=True)
return
# Keep the original ListBox defunct proof; GtkBox also forwards additions.
for container in ("list", "box"):
@@ -104,7 +105,7 @@ def run_table_probe(multi: bool = False, screen_lock: bool = False) -> None:
fixture.wait(timeout=3)
def run_probe(container, flat=False, terminal=False, terminal_mode=""):
def run_probe(container, flat=False, terminal=False, terminal_mode="", echo_focus=False):
environment = dict(os.environ, CTHULHU_TREE_CONTAINER=container)
environment["CTHULHU_VTE_MODE"] = terminal_mode
fixture = subprocess.Popen([
@@ -137,6 +138,7 @@ def run_probe(container, flat=False, terminal=False, terminal_mode=""):
"./internal/review" if flat else "./internal/atspi",
"-run",
"^TestNativeMouseReviewPointerAndHitTest$" if os.environ.get("CTHULHU_MOUSE_REVIEW") == "1" else
"^TestNativeEchoEditFieldFocus$" if echo_focus else
"^TestNativeSpeechMetadata$" if os.environ.get("CTHULHU_SPEECH_METADATA") == "1" else
"^TestNativeTerminalFlatReview$" if terminal else "^TestNativeFlatReview$" if flat else "^TestNativeTreeCaptureDefunctAndShutdownInvalidation$",
"-count=1",
+22 -2
View File
@@ -1051,10 +1051,14 @@ def inside():
page + " page did not open")
# Verify keyboard access, master sensitivity, and echo protocol values.
master = named("Enable key echo")
disabled = named("Disable key echo")
edit_fields = named("Key echo in edit fields")
for radio in (disabled, master, edit_fields):
assert radio.getRole() == pyatspi.ROLE_RADIO_BUTTON, radio.name
alphabetic = named("Enable alphabetic keys")
assert master.getState().contains(pyatspi.STATE_CHECKED)
assert alphabetic.getState().contains(pyatspi.STATE_CHECKED)
focus(master); key("space")
focus(disabled); key("space")
wait_for(lambda: not alphabetic.getState().contains(pyatspi.STATE_SENSITIVE), "master did not disable categories")
focus(named("Apply")); key("space")
off = request()
@@ -1067,6 +1071,22 @@ def inside():
wait_for(lambda: master.getState().contains(pyatspi.STATE_SENSITIVE), "key echo master stayed insensitive")
focus(master); key("space")
wait_for(lambda: master.getState().contains(pyatspi.STATE_CHECKED), "key echo master did not re-enable")
# The three choices are one keyboard radio group. Tab exits the group,
# Shift+Tab returns to the selected radio, and Apply reloads the mode.
key("Down")
wait_for(lambda: edit_fields.getState().contains(pyatspi.STATE_CHECKED), "Down did not select edit-fields-only")
assert not master.getState().contains(pyatspi.STATE_CHECKED)
key("Tab")
wait_for(lambda: alphabetic.getState().contains(pyatspi.STATE_FOCUSED), "Tab did not leave echo radio group")
key("shift+Tab")
wait_for(lambda: edit_fields.getState().contains(pyatspi.STATE_FOCUSED), "Shift+Tab did not return to selected radio")
focus(named("Apply")); key("space")
edit_only = request()
assert edit_only["Values"]["EnableKeyEcho"] and edit_only["Values"]["KeyEchoInEditFieldsOnly"], edit_only
send(dict(initial, Values=edit_only["Values"], Message="Edit fields echo saved."))
wait_for(lambda: named("Apply").getState().contains(pyatspi.STATE_SENSITIVE), "edit-fields Apply stayed busy")
assert edit_fields.getState().contains(pyatspi.STATE_CHECKED)
assert alphabetic.getState().contains(pyatspi.STATE_SENSITIVE)
focus(named("Use custom echo voice")); key("space")
echo_rate = named("Key echo rate")
wait_for(lambda: echo_rate.getState().contains(pyatspi.STATE_SENSITIVE), "custom voice controls disabled")
@@ -1088,7 +1108,7 @@ def inside():
ev = echo_saved["Values"]
assert ev["ProgressBar"] == expectedProgress, ev
assert echo_saved["Save"] and echo_saved["Close"] and ev["EnableKeyEcho"], echo_saved
assert ev["UseCustomEchoVoice"] and ev["UseCustomEchoForWord"], ev
assert ev["UseCustomEchoVoice"] and ev["UseCustomEchoForWord"] and ev["KeyEchoInEditFieldsOnly"], ev
assert ev["EchoVoice"]["Rate"] == 83 and ev["EchoVoice"]["AveragePitch"] == 7.5 and ev["EchoVoice"]["Gain"] == 10, ev
assert ev["EchoVoice"]["Family"]["Name"] == "Test voice", ev
send(dict(initial, Values=ev, Message="Echo voice saved."))