Skip to content

Commit 816dbac

Browse files
committed
An example for app_speech, so the site builds again
The generator requires an example for every tool, and app_speech (mobiumdev/mobium#254) has none, so the next scheduled build would fail as it did for app_assistant. Three scenarios on MobiumApp's Form Demo, in all five clients: what the screen reader says where its cursor is, a walk of the screen in its order, and the cursor put on Pro. All three are captured on the Android 15 emulator with TalkBack on, and the picture shows TalkBack's green cursor on Pro, unselected. The capture needs TalkBack's log output level at VERBOSE, its own setting: it was set there by hand before and back to ERROR after, and TalkBack is off again. check_examples: 116 scenarios, 0 problems in every client, .NET included.
1 parent 3b2e301 commit 816dbac

9 files changed

Lines changed: 111 additions & 0 deletions

File tree

‎data/runs.json‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,5 +777,30 @@
777777
"exit": 0,
778778
"output": "asked Google Assistant (typed, not spoken): \"Open Clock\"\nit showed no text a screen read can see\nin front: com.google.android.deskclock\ncom.google.android.deskclock came forward",
779779
"after": "/img/shots/app_assistant-0-after.jpg"
780+
},
781+
"app_speech[2]": {
782+
"tool": "app_speech",
783+
"index": 2,
784+
"command": "mobium speech label=Pro",
785+
"verbatim": true,
786+
"exit": 0,
787+
"output": "TalkBack says: \"not checked. Pro. Radio button\" — Pro (radio)",
788+
"after": "/img/shots/app_speech-2-after.jpg"
789+
},
790+
"app_speech[0]": {
791+
"tool": "app_speech",
792+
"index": 0,
793+
"command": "mobium speech",
794+
"verbatim": true,
795+
"exit": 0,
796+
"output": "TalkBack says: \"not checked. Pro. Radio button\" — Pro (radio)"
797+
},
798+
"app_speech[1]": {
799+
"tool": "app_speech",
800+
"index": 1,
801+
"command": "mobium speech --walk --limit 20",
802+
"verbatim": true,
803+
"exit": 0,
804+
"output": "TalkBack says:\n 1. \"not checked. Team. Radio button\" — Team (radio)\n 2. \"OFF. Dark mode. Switch\" — Dark mode (switch)\n 3. \"Dark mode, for the whole app\" — Dark mode, for the whole app, not in map\n 4. \"Read-only\" — Read-only, not in map\n 5. \"This field cannot be edited. Edit box. disabled\"\n 6. \"notify=false terms=false plan=free theme=light\" — notify=false terms=false plan=free theme=light, not in map\n 7. (nothing)\n 8. \"Back. Button\" — Back (button)\n 9. \"Form\" — Form, not in map\n 10. \"not checked. Email me. Check box\" — Email me (checkbox)\n 11. \"not checked. Accept terms. Check box\" — Accept terms (checkbox)\n 12. \"checked. Free. Radio button\" — Free (radio)\n 13. \"not checked. Pro. Radio button\" — Pro (radio)\nended: the cursor came back round to the first element"
780805
}
781806
}

‎examples/canonical.json‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,28 @@
917917
}
918918
}
919919
],
920+
"app_speech": [
921+
{
922+
"title": "Say what the screen reader says about the element its cursor is on",
923+
"cli": "mobium speech",
924+
"args": {}
925+
},
926+
{
927+
"title": "Walk the screen in the screen reader's order, each sentence beside its element",
928+
"cli": "mobium speech --walk --limit 20",
929+
"args": {
930+
"walk": true,
931+
"limit": 20
932+
}
933+
},
934+
{
935+
"title": "Put the screen reader's cursor on an element, and hear what it says",
936+
"cli": "mobium speech label=Pro",
937+
"args": {
938+
"target": "label=Pro"
939+
}
940+
}
941+
],
920942
"app_hit_test": [
921943
{
922944
"title": "Ask where a tap on an element would really land",

‎examples/dotnet.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,17 @@
459459
"code": "var got = device.Assistant(\"What is 15 times 3\", timeoutSeconds: 20);\nConsole.WriteLine(got[\"answer\"]);"
460460
}
461461
],
462+
"app_speech": [
463+
{
464+
"code": "var said = device.Speech();\nConsole.WriteLine(said[\"steps\"]);"
465+
},
466+
{
467+
"code": "var walk = device.Speech(walk: true, limit: 20);\nConsole.WriteLine($\"{walk[\"steps\"]} ended {walk[\"ended\"]}\");"
468+
},
469+
{
470+
"code": "var said = device.Speech(\"label=Pro\");\nConsole.WriteLine(said[\"steps\"]);"
471+
}
472+
],
462473
"app_hit_test": [
463474
{
464475
"code": "var hit = device.HitTest(\"testid=submit\");\nConsole.WriteLine(hit[\"reaches\"]);"

‎examples/go.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,17 @@
459459
"code": "got, err := dev.Assistant(ctx, \"What is 15 times 3\", mobium.AssistantOptions{Timeout: 20 * time.Second})\nif err != nil {\n\treturn err\n}\nfmt.Println(got.Answer)"
460460
}
461461
],
462+
"app_speech": [
463+
{
464+
"code": "said, err := dev.Speech(ctx, mobium.SpeechOptions{})\nif err != nil {\n\treturn err\n}\nfmt.Println(said.Steps[0].Said)"
465+
},
466+
{
467+
"code": "walk, err := dev.Speech(ctx, mobium.SpeechOptions{Walk: true, Limit: 20})\nif err != nil {\n\treturn err\n}\nfor _, step := range walk.Steps {\n\tfmt.Println(step.Said)\n}\nfmt.Println(\"ended:\", walk.Ended)"
468+
},
469+
{
470+
"code": "said, err := dev.Speech(ctx, mobium.SpeechOptions{Target: \"label=Pro\"})\nif err != nil {\n\treturn err\n}\nfmt.Println(said.Steps[0].Said)"
471+
}
472+
],
462473
"app_hit_test": [
463474
{
464475
"code": "hit, err := dev.HitTest(ctx, \"testid=submit\")\nif err != nil {\n\treturn err\n}\nfmt.Println(hit.Reaches)"

‎examples/java.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,17 @@
459459
"code": "Map<String, Object> got = device.assistant(\"What is 15 times 3\", null, 20);\nSystem.out.println(got.get(\"answer\"));"
460460
}
461461
],
462+
"app_speech": [
463+
{
464+
"code": "Map<String, Object> said = device.speech(null, false, 0);\nSystem.out.println(said.get(\"steps\"));"
465+
},
466+
{
467+
"code": "Map<String, Object> walk = device.speech(null, true, 20);\nSystem.out.println(walk.get(\"steps\") + \" ended \" + walk.get(\"ended\"));"
468+
},
469+
{
470+
"code": "Map<String, Object> said = device.speech(\"label=Pro\", false, 0);\nSystem.out.println(said.get(\"steps\"));"
471+
}
472+
],
462473
"app_hit_test": [
463474
{
464475
"code": "Map<String, Object> hit = device.hitTest(\"testid=submit\");\nSystem.out.println(hit.get(\"reaches\"));"

‎examples/javascript.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,17 @@
459459
"code": "const got = await device.assistant('What is 15 times 3', { timeout: 20 })\nconsole.log(got.answer)"
460460
}
461461
],
462+
"app_speech": [
463+
{
464+
"code": "const said = await device.speech()\nconsole.log(said.steps)"
465+
},
466+
{
467+
"code": "const walk = await device.speech({ walk: true, limit: 20 })\nconsole.log(walk.steps, walk.ended)"
468+
},
469+
{
470+
"code": "const said = await device.speech({ target: 'label=Pro' })\nconsole.log(said.steps)"
471+
}
472+
],
462473
"app_hit_test": [
463474
{
464475
"code": "const hit = await device.hitTest('testid=submit')\nconsole.log(hit.reaches)"

‎examples/python.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,17 @@
459459
"code": "got = device.assistant(\"What is 15 times 3\", timeout=20)\nprint(got[\"answer\"])"
460460
}
461461
],
462+
"app_speech": [
463+
{
464+
"code": "said = device.speech()\nprint(said[\"steps\"][0][\"said\"])"
465+
},
466+
{
467+
"code": "walk = device.speech(walk=True, limit=20)\nfor step in walk[\"steps\"]:\n print(step[\"said\"], step.get(\"element\", {}).get(\"label\"))"
468+
},
469+
{
470+
"code": "said = device.speech(\"label=Pro\")\nprint(said[\"steps\"])"
471+
}
472+
],
462473
"app_hit_test": [
463474
{
464475
"code": "hit = device.hit_test(\"testid=submit\")\nprint(hit[\"reaches\"])"

‎scripts/capture.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@ def app_screen(name):
157157
# terminated first, so the picture shows the assistant bringing it forward.
158158
dict(tool="app_assistant", i=0, setup=["terminate com.google.android.deskclock", "press home"], after=True,
159159
pause=2.0, restore=["terminate com.google.android.deskclock", "press home"]),
160+
# The screen reader on the Form Demo, TalkBack turned on after the screen
161+
# is up. The cursor is put on Pro first, so the picture shows TalkBack's
162+
# green rectangle there and the plain read after it says Pro; the walk
163+
# goes last, and TalkBack goes off. Needs TalkBack's log output level at
164+
# VERBOSE, which is TalkBack's own setting: set it there before, and back.
165+
dict(tool="app_speech", i=2, setup=app_screen("Form Demo") + ["wait label=Pro", "accessibility screen_reader on",
166+
"$sleep 3"], after=True, pause=1.0),
167+
dict(tool="app_speech", i=0),
168+
dict(tool="app_speech", i=1, restore=["accessibility screen_reader off"]),
160169
dict(tool="app_list_apps", i=0),
161170
dict(tool="app_contexts", i=0, setup=app_screen("WebViews") + ["tap 'text=Plain page'", "wait text=Back"],
162171
after=True),
26.2 KB
Loading

0 commit comments

Comments
 (0)