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.
60 lines
1.5 KiB
Go
60 lines
1.5 KiB
Go
//go:build linux && !android && (amd64 || arm64)
|
|
|
|
package linux
|
|
|
|
import (
|
|
"runtime"
|
|
"testing"
|
|
"unsafe"
|
|
|
|
"github.com/egoist/mygo/internal/platform"
|
|
)
|
|
|
|
func TestEventPhysicalKey(t *testing.T) {
|
|
// The field order/types from GTK 3's gdk/gdkevents.h, without cgo.
|
|
// In particular, the deprecated string pointer precedes hardware_keycode.
|
|
type gdkEventKey struct {
|
|
kind int32
|
|
window uintptr
|
|
sendEvent int8
|
|
time uint32
|
|
state uint32
|
|
keyval uint32
|
|
length int32
|
|
text uintptr
|
|
hardwareKeycode uint16
|
|
group uint8
|
|
isModifier uint32
|
|
}
|
|
var event gdkEventKey
|
|
if offset := unsafe.Offsetof(event.hardwareKeycode); offset != 48 {
|
|
t.Fatalf("hardware_keycode offset = %d, want 48", offset)
|
|
}
|
|
for _, tc := range []struct {
|
|
code uint16
|
|
want platform.Key
|
|
}{
|
|
{0, platform.KeyUnknown},
|
|
{7, platform.KeyUnknown},
|
|
{31 + 8, platform.KeyS},
|
|
{41 + 8, platform.KeyBackquote},
|
|
{53 + 8, platform.KeySlash},
|
|
{98 + 8, platform.KeyUnknown}, // Keypad slash is not the main slash.
|
|
} {
|
|
event.hardwareKeycode = tc.code
|
|
if got := eventPhysicalKey(ptr(unsafe.Pointer(&event))); got != tc.want {
|
|
t.Errorf("hardware_keycode=%d: got %v, want %v", tc.code, got, tc.want)
|
|
}
|
|
runtime.KeepAlive(&event)
|
|
}
|
|
}
|
|
|
|
func TestCursorNames(t *testing.T) {
|
|
// Every cursor has its CSS name, which cursor themes name theirs by.
|
|
for c := platform.CursorDefault; c <= platform.CursorNoDrop; c++ {
|
|
if cursorNames[c] == "" {
|
|
t.Errorf("cursor %d has no name", c)
|
|
}
|
|
}
|
|
}
|