Files
openchamber-android-native/third_party/mygo/plugins/glass/gpu_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

59 lines
1.7 KiB
Go

//go:build !ios
package glass
import (
"testing"
"github.com/egoist/mygo/internal/gpu"
"github.com/egoist/mygo/internal/gpu/gputest"
"github.com/egoist/mygo/internal/gpu/metal"
)
// TestMetal checks that Metal draws the glass as the CPU does.
func TestMetal(t *testing.T) {
s := testScene()
pix, err := metal.RenderOffscreen(s)
if err != nil {
t.Skip("no Metal:", err)
}
gputest.Compare(t, "glass-metal", pix, s.Width*4, s)
// With continuous corners, as macOS's.
for i := range s.Ops {
s.Ops[i].Continuous = true
}
if pix, err = metal.RenderOffscreen(s); err != nil {
t.Fatal(err)
}
gputest.Compare(t, "glass-metal-continuous", pix, s.Width*4, s)
}
// TestMetalBlur checks that Metal draws the blur as the CPU does.
func TestMetalBlur(t *testing.T) {
s := blurScene()
pix, err := metal.RenderOffscreen(s)
if err != nil {
t.Skip("no Metal:", err)
}
gputest.Compare(t, "blur-metal", pix, s.Width*4, s)
for i := range s.Ops {
s.Ops[i].Continuous = true
}
if pix, err = metal.RenderOffscreen(s); err != nil {
t.Fatal(err)
}
gputest.Compare(t, "blur-metal-continuous", pix, s.Width*4, s)
}
// TestMetalLibrary checks that the libraries compiled ahead of time come
// from glass.metal and blur.metal and the renderer's head and tail as
// they are.
func TestMetalLibrary(t *testing.T) {
if gpu.SourceSum(metal.EffectSource(metalSource)) != metalSum {
t.Error("glass.metal or the Metal renderer's effect.metal changed since shaders_darwin.go was generated: run go generate ./plugins/glass on macOS")
}
if gpu.SourceSum(metal.EffectSource(blurMetalSource)) != blurMetalSum {
t.Error("blur.metal or the Metal renderer's effect.metal changed since shaders_darwin.go was generated: run go generate ./plugins/glass on macOS")
}
}