Handle long presses: push-to-talk, with a tap-like fallback
On a real G2 a touch held slightly too long is reported as a long press (sysEvent type 9, then type 10 on release; source 1 right temple, 3 left), not as a tap, and was ignored. A long press now does what a tap does. If it started a recording and is held at least 700 ms, releasing it sends (push-to-talk); released sooner, it behaves like a tap and the recording continues until the next tap or press. Tests: 219 unit/integration; simulator 7 scenarios (long_press / long_press_release through the automation API). Not reviewed, not deployed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -304,6 +304,26 @@ describe('Even Hub simulator 0.9.5', () => {
|
||||
expect(h.hermes.executions).toBe(2);
|
||||
});
|
||||
|
||||
it('hold to talk: a long press starts recording and releasing it sends', async () => {
|
||||
h.stt.next({ text: 'simulated held question' });
|
||||
const before = h.hermes.executions;
|
||||
const mark = consoleLines.length;
|
||||
await input('long_press');
|
||||
await waitConsole('-> listening', 10_000, mark);
|
||||
// Held well past the push-to-talk threshold. (With the unpaced null audio device the capture
|
||||
// cap may be reached first; either way the recording must end and be answered once.)
|
||||
await new Promise((r) => setTimeout(r, 1000));
|
||||
await input('long_press_release');
|
||||
await waitConsole('-> answer', 20_000, mark);
|
||||
expect(h.hermes.executions).toBe(before + 1);
|
||||
expect(h.hermes.lastRun()!.input).toBe('simulated held question');
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
await screenshot('09-hold-to-talk-answer');
|
||||
// Leave the app at rest for the checks that follow.
|
||||
await input('double_click');
|
||||
await waitConsole('state: answer -> ready', 10_000, mark);
|
||||
});
|
||||
|
||||
it('no uncaught errors or failed fetches were reported by the webview', async () => {
|
||||
await pumpConsole();
|
||||
const problems = consoleLines.filter((l) => /\[uncaught\]|\[unhandledrejection\]|\[fetch\]/.test(l));
|
||||
|
||||
Reference in New Issue
Block a user