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.
53 lines
1.8 KiB
Go
53 lines
1.8 KiB
Go
package ui
|
|
|
|
import "testing"
|
|
|
|
// TestNewTesterWith starts a Tester under reduced motion, in the dark,
|
|
// with a coarse pointer that does not hover: its first build reads them,
|
|
// and a card that fades in as the view mounts it shows at once, where
|
|
// with NewTester it starts fading in before SetPreferences comes.
|
|
func TestNewTesterWith(t *testing.T) {
|
|
var first *Preferences
|
|
var firstDark, moved bool
|
|
builds := 0
|
|
var shown float32
|
|
view := func(c *context) {
|
|
builds++
|
|
if p := c.Preferences(); first == nil {
|
|
first, firstDark = &p, c.Theme().Dark
|
|
}
|
|
card := coreBox(c).Key("card").Size(20, 20)
|
|
target := float32(0)
|
|
if builds == 1 {
|
|
c.Invalidate() // mounted: fade in from the next frame
|
|
} else {
|
|
target = 1
|
|
}
|
|
shown = card.AnimateTo("shown", target, Smooth)
|
|
moved = moved || !card.Settled("shown")
|
|
}
|
|
prefs := Preferences{ReduceMotion: true, TextScale: 1, Pointer: PointerCoarse, AnyPointer: PointerCoarse, NoHover: true, NoAnyHover: true}
|
|
coreNewTesterWith(view, 200, 100, TesterOptions{Preferences: prefs, Dark: true})
|
|
if *first != prefs || !firstDark {
|
|
t.Errorf("the first build reads %+v, dark %v", *first, firstDark)
|
|
}
|
|
if first.Hover() || first.AnyHover() {
|
|
t.Error("a pointer that does not hover hovers")
|
|
}
|
|
if builds < 2 || moved || shown != 1 {
|
|
t.Errorf("under reduced motion from the start, after %d builds the card moved %v and shows %v", builds, moved, shown)
|
|
}
|
|
|
|
// NewTester settles its first frames without them: the card starts
|
|
// to fade in.
|
|
first, moved, builds = nil, false, 0
|
|
tt := coreNewTester(view, 200, 100)
|
|
tt.SetPreferences(prefs)
|
|
if first.ReduceMotion || first.Pointer != PointerFine || !first.Hover() || firstDark {
|
|
t.Errorf("NewTester's first build reads %+v, dark %v", *first, firstDark)
|
|
}
|
|
if !moved {
|
|
t.Error("with NewTester, the card does not start fading in")
|
|
}
|
|
}
|