Options for controlling how and when speech is interrupted now wired up in preferences under the speech tab.
This commit is contained in:
1 parent
e62f8c8e17
commit
3e9c4f83ce
32 files changed
+784
-47
No files matched your search
@@ -185,7 +185,35 @@ def check_flat_review(tabs, server, readerLog):
|
||||
server.snapshot()[-1]["finished"], "return to tab header was suppressed")
|
||||
|
||||
|
||||
def check_runtime(radioOnly=False, flatReviewOnly=False):
|
||||
def check_interruption_summary(controls, tabs, server):
|
||||
import pyatspi
|
||||
|
||||
def key(*keys):
|
||||
subprocess.run(["xdotool", "key", "--clearmodifiers", *keys], check=True)
|
||||
|
||||
assert tabs.querySelection().selectChild(2)
|
||||
summary = controls["Defined interruption keys"]
|
||||
assert summary.queryText().getText(0, -1) == "Tab, Enter"
|
||||
assert not summary.getState().contains(pyatspi.STATE_EDITABLE)
|
||||
assert controls["Record interruption keys"].queryComponent().grabFocus()
|
||||
offset = len(server.snapshot())
|
||||
key("Tab")
|
||||
wait_for(lambda: any(record["text"] == "Tab, Enter" and record["finished"]
|
||||
for record in server.snapshot()[offset:]), "read-only summary contents were not spoken on focus")
|
||||
assert any(record["text"] == "Defined interruption keys" for record in server.snapshot()[offset:])
|
||||
key("Home")
|
||||
for keyName, character, caret in (("Right", "a", 1), ("Left", "T", 0)):
|
||||
offset = len(server.snapshot())
|
||||
key(keyName)
|
||||
wait_for(lambda: summary.queryText().caretOffset == caret, "summary caret did not move for " + keyName)
|
||||
wait_for(lambda: any(record["text"] == character and record["finished"]
|
||||
for record in server.snapshot()[offset:]), "summary character was not spoken for " + keyName)
|
||||
key("shift+Tab")
|
||||
wait_for(lambda: controls["Record interruption keys"].getState().contains(pyatspi.STATE_FOCUSED),
|
||||
"read-only summary trapped Shift+Tab")
|
||||
|
||||
|
||||
def check_runtime(radioOnly=False, flatReviewOnly=False, interruptionOnly=False):
|
||||
import pyatspi
|
||||
directory = Path(tempfile.mkdtemp(prefix="cthulhu-echo-runtime-"))
|
||||
binary = os.environ["CTHULHU_BINARY"]
|
||||
@@ -218,6 +246,9 @@ gain = 5
|
||||
name = "Echo A"
|
||||
lang = "en"
|
||||
''')
|
||||
if interruptionOnly:
|
||||
with configPath.open("a") as settingsFile:
|
||||
settingsFile.write('\n[profiles.default.speech.interruption]\nmode = "custom"\nkeys = ["Tab", "Return"]\n')
|
||||
if radioOnly:
|
||||
configPath.write_text(configPath.read_text().replace(
|
||||
"[profiles.default.sound]\nenabled = false",
|
||||
@@ -257,6 +288,10 @@ lang = "en"
|
||||
xid = subprocess.check_output(["xdotool", "search", "--onlyvisible", "--name", "^Cthulhu Preferences$"], text=True).splitlines()[0]
|
||||
subprocess.run(["xdotool", "windowactivate", "--sync", xid], check=True)
|
||||
tabs = next(node for node in walk(window) if node.getRole() == pyatspi.ROLE_PAGE_TAB_LIST)
|
||||
if interruptionOnly:
|
||||
check_interruption_summary(controls, tabs, server)
|
||||
print(f"PASS: real reader speaks read-only interruption summary on focus and character arrows; Tab traversal preserved; evidence: {directory}")
|
||||
return
|
||||
if flatReviewOnly:
|
||||
check_flat_review(tabs, server, directory / "reader.log")
|
||||
print(f"PASS: notebook flat review has no repeated tab speech; tab changes and focus returns speak; evidence: {directory}")
|
||||
|
||||
Reference in new issue
Block a user