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.
50 lines
1.7 KiB
Go
50 lines
1.7 KiB
Go
//go:build windows && (amd64 || arm64)
|
|
|
|
package windows
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/egoist/mygo/internal/platform"
|
|
)
|
|
|
|
// TestServedAtBase checks which base URLs LoadHTML serves its document at:
|
|
// not about: URLs, which WebView2 never requests, so that their pages show
|
|
// the document as those without a base URL do (#1029).
|
|
func TestServedAtBase(t *testing.T) {
|
|
for base, want := range map[string]bool{
|
|
"": false,
|
|
"about:blank": false,
|
|
"about:blank#top": false,
|
|
"About:Blank": false,
|
|
"about:srcdoc": false,
|
|
"app://localhost/": true,
|
|
"https://example.com/about:blank": true,
|
|
"file:///C:/app/index.html": true,
|
|
} {
|
|
if got := servedAtBase(base); got != want {
|
|
t.Errorf("servedAtBase(%q) = %v, want %v", base, got, want)
|
|
}
|
|
}
|
|
}
|
|
|
|
// TestUnhandledKey turns the virtual keys keys.js tells of into the keys
|
|
// the content takes, leaving out Tab, modifier keys and unknown keys; the
|
|
// script calls the binding Go adds.
|
|
func TestUnhandledKey(t *testing.T) {
|
|
if !strings.Contains(keysScript, `"`+keysBinding+`"`) {
|
|
t.Fatalf("keys.js does not call the binding %q: run bun run build", keysBinding)
|
|
}
|
|
w := &window{}
|
|
ev, ok := unhandledKey(w, 'J', platform.ModCtrl|platform.ModShift, true)
|
|
if !ok || ev.Kind != platform.WebViewKey || ev.Key != platform.KeyJ || ev.Mods != platform.ModCtrl|platform.ModShift || !ev.Repeat || ev.WebView != platform.WebView(w) {
|
|
t.Errorf("J with Ctrl+Shift: %+v, %v", ev, ok)
|
|
}
|
|
for _, vk := range []uintptr{0x09, vkShift, vkControl, vkMenu, vkLWin, 0xA0, 0xFF} {
|
|
if _, ok := unhandledKey(w, vk, 0, false); ok {
|
|
t.Errorf("virtual key %#x reached the content", vk)
|
|
}
|
|
}
|
|
}
|