Files
openchamber-android-native/third_party/mygo/internal/linux/keyrepeat_test.go
T
OpenChamber 6c0ee61750 feat: port the client to MyGo native UI (0.3.0)
Switch from Asuka to MyGo, keeping the API client and the feature set:

- servers: saved servers, passwordless and password login, proxy,
  self-signed certificates, per-server device tokens (Keystore), connect
  form, instance list sheet with switch/disconnect
- sessions: virtualized list, search, new session, rename/archive/delete,
  running indicator, event stream keeps it live
- chat: pushed window with system back bar, streaming Markdown via
  ui/markdown, reasoning and tool rows with image previews, footer menu
  (read aloud via a Kotlin TTS plugin, copy, fork), user message menu
  (copy, revert, fork), context usage ring and detail sheet, attachments
  (photos/files via the document picker), permissions
- release builds allow plain http:// LAN servers (Go's net/http dials
  directly, no cleartext manifest needed)
- a local fork of MyGo (third_party/mygo) lowers the Android host's
  minSdk to 24 (Android 7.0); Go 1.27.4 via mise

Version 0.3.0.
2026-11-18 13:22:59 +08:00

52 lines
1.2 KiB
Go

//go:build linux && !android && (amd64 || arm64)
package linux
import "testing"
func TestKeysDownRepeat(t *testing.T) {
var d keysDown
if d.press(38) {
t.Fatal("the first press is no repeat")
}
if !d.press(38) || !d.press(38) {
t.Fatal("presses of a key held with no release between are repeats")
}
if d.press(39) {
t.Fatal("another key's press is no repeat")
}
d.release(38)
if d.press(38) {
t.Fatal("a press after the release is no repeat")
}
d.clear()
if d.press(38) || d.press(39) {
t.Fatal("presses after losing the keyboard are no repeats")
}
if d.press(0) || d.press(0) {
t.Fatal("a key with no keycode is never a repeat")
}
}
func TestKeysDownOtherSideHeld(t *testing.T) {
const leftShift, rightShift, leftSuper, rightSuper, a = 42 + 8, 54 + 8, 125 + 8, 126 + 8, 30 + 8
var d keysDown
if d.otherSideHeld(leftShift) {
t.Error("the other Shift is held with nothing held")
}
d.press(rightShift)
d.press(a)
if !d.otherSideHeld(leftShift) {
t.Error("the right Shift is held")
}
if d.otherSideHeld(rightShift) {
t.Error("the left Shift is not held")
}
if d.otherSideHeld(leftSuper) || d.otherSideHeld(rightSuper) {
t.Error("no Super is held")
}
if d.otherSideHeld(a) {
t.Error("A has no other side")
}
}