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.
This commit is contained in:
1 parent
2fb4a8ea79
commit
6c0ee61750
2538 files changed
+675779
-4792
No files matched your search
+53
@@ -0,0 +1,53 @@
|
||||
package editor
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/egoist/mygo/ui"
|
||||
)
|
||||
|
||||
// A deletion bar's stripes keep to the content: those of lines whose
|
||||
// height isn't a multiple of 4 continue one another's, a stripe across
|
||||
// a join split between the two, and scrolling moves them with the lines.
|
||||
func TestBarStripes(t *testing.T) {
|
||||
// spans returns the stripes, as [top, bottom) in the content, of
|
||||
// lines of heights hs from top, at screenY on the screen.
|
||||
spans := func(top float64, screenY float32, hs ...float32) [][2]float32 {
|
||||
var out [][2]float32
|
||||
y := screenY
|
||||
for _, h := range hs {
|
||||
barStripes(ui.Rect{X: 0, Y: y, W: 4, H: h}, top+float64(y-screenY), func(r ui.Rect) {
|
||||
a, b := r.Y-screenY+float32(top), r.Y+r.H-screenY+float32(top)
|
||||
if n := len(out); n > 0 && out[n-1][1] == a {
|
||||
out[n-1][1] = b // a stripe split at a join
|
||||
return
|
||||
}
|
||||
out = append(out, [2]float32{a, b})
|
||||
})
|
||||
y += h
|
||||
}
|
||||
return out
|
||||
}
|
||||
check := func(name string, got [][2]float32, from, to float32) {
|
||||
t.Helper()
|
||||
var want [][2]float32
|
||||
for y := float32(0); y < to; y += 4 {
|
||||
if a, b := max(y, from), min(y+2, to); b > a {
|
||||
want = append(want, [2]float32{a, b})
|
||||
}
|
||||
}
|
||||
if len(got) != len(want) {
|
||||
t.Fatalf("%s: stripes %v, want %v", name, got, want)
|
||||
}
|
||||
for i := range got {
|
||||
if got[i] != want[i] {
|
||||
t.Fatalf("%s: stripes %v, want %v", name, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
check("18", spans(0, 10, 18, 18, 18), 0, 54)
|
||||
check("19.5", spans(0, 10, 19.5, 19.5, 19.5), 0, 58.5)
|
||||
// Lines from 37 in the content, scrolled by 11.25 and by 12.
|
||||
check("scrolled", spans(37, 25.75, 19.5, 19.5), 37, 76)
|
||||
check("scrolled more", spans(37, 25, 19.5, 19.5), 37, 76)
|
||||
}
|
||||
Reference in new issue
Block a user