Add key input handling functionality to the agent. Implement API endpoint for sending key presses with support for action types (tap, down, up) and modifiers. Update web interface to allow users to send keys and toggle modifier states through a new interactive element.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package input
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestVkCode(t *testing.T) {
|
||||
t.Parallel()
|
||||
cases := map[string]uint16{
|
||||
"a": 0x41,
|
||||
"A": 0x41,
|
||||
"enter": 0x0D,
|
||||
"ctrl": 0x11,
|
||||
"win": 0x5B,
|
||||
"f5": 0x74,
|
||||
}
|
||||
for name, want := range cases {
|
||||
got, ok := vkCode(name)
|
||||
if !ok || got != want {
|
||||
t.Fatalf("vkCode(%q) = (%v, %v), want %v", name, got, ok, want)
|
||||
}
|
||||
}
|
||||
if _, ok := vkCode("notakey"); ok {
|
||||
t.Fatal("expected unknown key")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user