Files
openchamber-android-native/third_party/mygo/internal/e2e/access_relations_darwin_test.go
T
OpenChamber 6c0ee61750 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.
2026-11-18 13:22:59 +08:00

52 lines
1.7 KiB
Go

//go:build darwin && !ios
package e2e
import (
"strings"
"sync/atomic"
"testing"
"github.com/egoist/mygo"
"github.com/egoist/mygo/ui"
)
// TestAccessDescribedByErrorMessageSearch reads, as VoiceOver does, a
// search field of the app's own described by a hint (AXHelp), invalid,
// and pointing at the element holding its error (AXErrorMessageElements,
// as WebKit's aria-errormessage), which it names only while invalid.
func TestAccessDescribedByErrorMessageSearch(t *testing.T) {
var frames atomic.Int32
var bad atomic.Bool
bad.Store(true)
view := func(c *ui.Context) {
frames.Add(1)
var query string
ui.Column(c).Fill().Padding(20).Gap(10).Children(func() {
hint := ui.Text(c, "Titles only")
msg := ui.Text(c, "Type a word")
ui.TextInput(c, &query).Label("Find").Search().DescribedBy(hint).Invalid(bad.Load()).ErrorMessage(msg)
})
}
w := newWindow(t, mygo.WindowOptions{Title: "Relations", Width: 400, Height: 300, Content: ui.View(view)})
eventually(t, "a frame", func() bool { return frames.Load() > 0 })
for _, c := range []struct{ attr, want string }{
{"AXSubrole", "AXSearchField"},
{"AXHelp", "Type a word\nTitles only"},
{"AXInvalid", "true"},
{"AXErrorMessageElements", "MyGoAccessibilityElement"},
} {
eventually(t, "the field's "+c.attr, func() bool {
v, _, named, ok := axAttribute(w, "Find", c.attr)
return ok && (named || c.attr == "AXSubrole") && strings.Contains(v, c.want)
})
}
bad.Store(false)
w.Invalidate()
eventually(t, "the valid field", func() bool {
v, _, named, ok := axAttribute(w, "Find", "AXErrorMessageElements")
help, _, _, _ := axAttribute(w, "Find", "AXHelp")
return ok && !named && v == "" && help == "Titles only"
})
}