Fenrir's emoji ported to cthulhu.
This commit is contained in:
1 parent
3e2429b8a5
commit
01f50c17e8
24 files changed
+1505
-9
No files matched your search
@@ -42,7 +42,7 @@ func TestNativeInternalUIActionsAndEntry(t *testing.T) {
|
||||
defer service.Stop(context.Background())
|
||||
}
|
||||
output := &ocrTestOutput{speech: make(chan speechRequest, 256)}
|
||||
ui := &internalUI{keys: keys, actions: adapter, interest: worker, speech: output, gate: newFocusGate(keys), events: make(chan input.CommandEvent, 32), requests: make(chan internalUIRequest, 1), done: make(chan struct{})}
|
||||
ui := &internalUI{keys: keys, emojiSource: adapter, emojiCopier: xclipOCRCopier{}, actions: adapter, interest: worker, speech: output, gate: newFocusGate(keys), events: make(chan input.CommandEvent, 32), requests: make(chan internalUIRequest, 1), done: make(chan struct{})}
|
||||
go ui.run(ctx)
|
||||
focused := make(chan struct{}, 1)
|
||||
done := make(chan struct{})
|
||||
@@ -176,6 +176,71 @@ copied:
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
// Exercise the real shortcut, modal capture, insertion and clipboard opt-out.
|
||||
waitSpeech := func(prefix string) {
|
||||
t.Helper()
|
||||
for {
|
||||
select {
|
||||
case message := <-output.speech:
|
||||
t.Logf("UI speech: %s", message.Text)
|
||||
if strings.HasPrefix(message.Text, prefix) {
|
||||
return
|
||||
}
|
||||
case <-ctx.Done():
|
||||
t.Fatalf("missing speech %q", prefix)
|
||||
}
|
||||
}
|
||||
}
|
||||
key("Insert+ctrl+e")
|
||||
waitSpeech("Emoji Menu. All tab")
|
||||
key("Tab", "g", "o", "a", "t", "Return")
|
||||
waitSpeech("Inserted Goat")
|
||||
_, text = read()
|
||||
if text != "q🐐" {
|
||||
t.Fatalf("emoji insertion: %q", text)
|
||||
}
|
||||
if clipboard, err := read_internal_clipboard(ctx); err != nil || clipboard != "aB!" {
|
||||
t.Fatalf("clipboard changed with copying off: %q %v", clipboard, err)
|
||||
}
|
||||
// The next invocation remembers copying off and replaces a selection with a
|
||||
// complete multi-codepoint emoji, using character rather than byte offsets.
|
||||
key("ctrl+a", "Insert+ctrl+e")
|
||||
waitSpeech("Emoji Menu. All tab")
|
||||
key("Tab", "a", "s", "t", "r", "o", "n", "a", "u", "t", "Return")
|
||||
waitSpeech("Inserted Astronaut")
|
||||
_, text = read()
|
||||
if text != "🧑🚀" {
|
||||
t.Fatalf("emoji selection replacement: %q", text)
|
||||
}
|
||||
if clipboard, err := read_internal_clipboard(ctx); err != nil || clipboard != "aB!" {
|
||||
t.Fatalf("clipboard choice not remembered: %q %v", clipboard, err)
|
||||
}
|
||||
// A cancelled picker has no application or clipboard side effects.
|
||||
key("Insert+ctrl+e")
|
||||
waitSpeech("Emoji Menu. All tab")
|
||||
key("Tab", "g", "Escape")
|
||||
for keys.InternalUIActive() {
|
||||
if ctx.Err() != nil {
|
||||
t.Fatal("picker did not cancel")
|
||||
}
|
||||
time.Sleep(time.Millisecond)
|
||||
}
|
||||
_, text = read()
|
||||
if text != "🧑🚀" {
|
||||
t.Fatalf("cancel inserted text: %q", text)
|
||||
}
|
||||
// Restore the earlier fixture state for the remaining transfer checks.
|
||||
key("ctrl+a", "q")
|
||||
for {
|
||||
_, text = read()
|
||||
if text == "q" {
|
||||
break
|
||||
}
|
||||
if ctx.Err() != nil {
|
||||
t.Fatal("typing after emoji did not resume")
|
||||
}
|
||||
time.Sleep(time.Millisecond)
|
||||
}
|
||||
if err := adapter.PerformAccessibleAction(ctx, originalActions.Target, "click"); err == nil {
|
||||
t.Fatal("stale focus action was performed")
|
||||
}
|
||||
@@ -205,6 +270,7 @@ copied:
|
||||
t.Fatalf("virtual transfer=%+v %v", item, err)
|
||||
}
|
||||
key("ctrl+Tab")
|
||||
|
||||
for {
|
||||
if _, err = adapter.ReadTransferItem(ctx, worker.Focus(), -1); err != nil {
|
||||
break
|
||||
|
||||
Reference in new issue
Block a user