Files
openchamber-android-native/third_party/mygo/internal/e2e/popover_theme_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

48 lines
1.8 KiB
Go

//go:build darwin && !ios
package e2e
import (
"testing"
"github.com/egoist/mygo"
"github.com/egoist/mygo/internal/darwin"
"github.com/egoist/mygo/ui"
)
func TestPopoverAppearanceFollowsAppInsteadOfAnchor(t *testing.T) {
defer mygo.Theme.SetSource(mygo.Theme.Source())
mygo.Theme.SetSource(mygo.ThemeLight)
parent := newWindow(t, mygo.WindowOptions{Width: 300, Height: 200})
eventually(t, "anchor window visible", parent.IsVisible)
fl := mygo.NewFlyout(mygo.FlyoutOptions{Parent: parent, Anchor: mygo.Rectangle{X: 100, Y: 20, Width: 80, Height: 24}, Popover: true, Width: 220, Height: 120, Content: ui.View(func(c *ui.Context) { ui.Text(c, "Popover theme test") })})
defer fl.Destroy()
eventually(t, "popover window adopted", func() bool { return fl.NativeHandle() != 0 })
appearance := func() (chrome, window, content string) {
mygo.RunOnMain(func() { chrome, window, content = darwin.TestPopoverAppearance(fl.NativeHandle()) })
return
}
if chrome, window, content := appearance(); chrome == "" {
t.Fatalf("native popover inherits the status-item appearance instead of following the app (handle=%x visible=%v window=%s content=%s)", fl.NativeHandle(), fl.IsVisible(), window, content)
}
mygo.RunOnMain(func() { darwin.TestSetPopoverAnchorAppearance(fl.NativeHandle(), false) })
check := func() {
want := "NSAppearanceNameAqua"
if mygo.Theme.IsDark() {
want = "NSAppearanceNameDarkAqua"
}
eventually(t, "popover chrome, window and content match "+want, func() bool {
chrome, window, content := appearance()
return chrome == want && window == want && content == want
})
}
for _, source := range []mygo.ThemeSource{mygo.ThemeDark, mygo.ThemeLight, mygo.ThemeDark, mygo.ThemeSystem} {
mygo.Theme.SetSource(source)
check()
}
fl.Hide()
mygo.Theme.SetSource(mygo.ThemeDark)
fl.Show()
check()
}