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.
57 lines
1.5 KiB
Go
57 lines
1.5 KiB
Go
package ui
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"golang.org/x/image/font/gofont/gomono"
|
|
)
|
|
|
|
// TestTwoTestersInParallel runs Testers on different goroutines, as
|
|
// t.Parallel does, and fails under go test -race while they share one
|
|
// glyph atlas (issue #1722).
|
|
func TestTwoTestersInParallel(t *testing.T) {
|
|
for i := range 4 {
|
|
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
|
t.Parallel()
|
|
frame := 0
|
|
tt := NewTester(func(c *Context) {
|
|
Column(c).Children(func() {
|
|
for j := range 30 {
|
|
r := rune(0x4e00 + i*3000 + frame*30 + j) // new glyphs every frame
|
|
Row(c).Children(func() {
|
|
Text(c, fmt.Sprintf("tester %d frame %d %c", i, frame, r)).FontSize(float32(11 + (frame+j)%9))
|
|
})
|
|
}
|
|
})
|
|
}, 400, 900)
|
|
for range 40 {
|
|
frame++
|
|
tt.Frame()
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
// A Tester's window, which shapes text in a system of its own, draws the
|
|
// fonts the app registered, as the app's windows do. Go Mono is
|
|
// monospaced, so "iiiiiiii" is as wide as "mmmmmmmm" only in it.
|
|
func TestATesterDrawsRegisteredFonts(t *testing.T) {
|
|
const family = "MyGo Test Tester Mono"
|
|
if err := RegisterFont(gomono.TTF, family); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
tt := NewTester(func(c *Context) {
|
|
Column(c).Children(func() {
|
|
for _, s := range []string{"iiiiiiii", "mmmmmmmm"} {
|
|
Row(c).Children(func() { Text(c, s).Font(family).FontSize(20) })
|
|
}
|
|
})
|
|
}, 400, 300)
|
|
i, _ := tt.Find("iiiiiiii")
|
|
m, _ := tt.Find("mmmmmmmm")
|
|
if i.W < m.W-0.5 || i.W > m.W+0.5 {
|
|
t.Fatalf("the registered font isn't drawn: %v wide, %v in Go Mono", i.W, m.W)
|
|
}
|
|
}
|