Files
Reims-Go/internal/console/held_key_test.go
T
NwflowerandClaude Opus 5.5 bd4e85af1a feat(plugin): scope MCP connections and add held input, region capture and force stop
- Each plugin connect connection gets a session id that is forwarded with
  channel/<id>/message; when the connection ends the host notifies the
  sidecar with channel/<id>/closed so it can cancel calls and release input.
- host/console.screenshot crops a region from the full-resolution frame,
  optionally measured in a reference image size, and full frames now honor
  max_width up to 2560.
- host/console.key can hold or release one key, and host/console.release
  lifts keys and pointer buttons in one call. Driver consoles stay press-only.
- host/vm.shutdown accepts force, and host/vm.snapshot.list needs only vm:read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 23:55:43 -07:00

25 lines
573 B
Go

package console
import "testing"
func TestNormalizeHeldKeyAcceptsModifiersAndKeys(t *testing.T) {
cases := map[string]string{
"cmd": "meta_l",
"Command": "meta_l",
"option": "alt",
"shift": "shift",
"a": "a",
"Return": "ret",
"space": "spc",
}
for in, want := range cases {
got, err := NormalizeHeldKey(in)
if err != nil || got != want {
t.Errorf("NormalizeHeldKey(%q) = %q, %v; want %q", in, got, err, want)
}
}
if _, err := NormalizeHeldKey("cmd+a"); err == nil {
t.Error("组合键不能作为单个按住的按键")
}
}