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
+101
@@ -0,0 +1,101 @@
|
||||
//go:build !ios
|
||||
|
||||
package shader
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/egoist/mygo/internal/gpu/gputest"
|
||||
"github.com/egoist/mygo/internal/gpu/metal"
|
||||
)
|
||||
|
||||
// TestMetal checks that Metal draws a shader, its uniforms and its
|
||||
// images, a bitmap and a canvas, as the CPU does.
|
||||
func TestMetal(t *testing.T) {
|
||||
s := MustCompile(testSource)
|
||||
sc := testScene(s)
|
||||
pix, err := metal.RenderOffscreen(sc)
|
||||
if err != nil {
|
||||
t.Skip("no Metal:", err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-metal", pix, sc.Width*4, sc)
|
||||
}
|
||||
|
||||
// TestMetalBools checks that Metal reads bools at the end of its struct of
|
||||
// uniforms, a byte each.
|
||||
func TestMetalBools(t *testing.T) {
|
||||
sc := boolScene()
|
||||
pix, err := metal.RenderOffscreen(sc)
|
||||
if err != nil {
|
||||
t.Skip("no Metal:", err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-metal-bools", pix, sc.Width*4, sc)
|
||||
}
|
||||
|
||||
// TestMetalDfdy checks that dfdy grows downward on Metal.
|
||||
func TestMetalDfdy(t *testing.T) {
|
||||
pix, err := metal.RenderOffscreen(dfdyScene())
|
||||
if err != nil {
|
||||
t.Skip("no Metal:", err)
|
||||
}
|
||||
checkDfdy(t, pix, 40*4)
|
||||
}
|
||||
|
||||
// TestMetalMasked checks that Metal fills mask glyphs with a shader, as
|
||||
// text and paths, as the CPU does.
|
||||
func TestMetalMasked(t *testing.T) {
|
||||
sc := maskedScene(MustCompile(maskedSource))
|
||||
pix, err := metal.RenderOffscreen(sc)
|
||||
if err != nil {
|
||||
t.Skip("no Metal:", err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-metal-masked", pix, sc.Width*4, sc)
|
||||
}
|
||||
|
||||
// TestMetalEffect checks that Metal draws an effect's shader from its
|
||||
// content, as the CPU does.
|
||||
func TestMetalEffect(t *testing.T) {
|
||||
for name, sc := range effectScenes(MustCompile(effectSource)) {
|
||||
pix, err := metal.RenderOffscreen(sc)
|
||||
if err != nil {
|
||||
t.Skip("no Metal:", err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-metal-effect-"+name, pix, sc.Width*4, sc)
|
||||
}
|
||||
}
|
||||
|
||||
// TestMetalBackdropEndsAtDrawn checks that Metal ends a backdrop at the
|
||||
// edge of what a frame draws (Scene.Drawn), as the CPU does.
|
||||
func TestMetalBackdropEndsAtDrawn(t *testing.T) {
|
||||
for name, scs := range edgeBackdrops() {
|
||||
sc := scs[1]
|
||||
pix, err := metal.RenderOffscreen(sc)
|
||||
if err != nil {
|
||||
t.Skip("no Metal:", err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-metal-backdrop-drawn-"+name, pix, sc.Width*4, sc)
|
||||
}
|
||||
}
|
||||
|
||||
// TestMetalBackdrop checks that Metal gives a shader its backdrop, as the
|
||||
// CPU does.
|
||||
func TestMetalBackdrop(t *testing.T) {
|
||||
for name, sc := range backdropCases() {
|
||||
pix, err := metal.RenderOffscreen(sc)
|
||||
if err != nil {
|
||||
t.Skip("no Metal:", err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-metal-backdrop-"+name, pix, sc.Width*4, sc)
|
||||
}
|
||||
}
|
||||
|
||||
// TestMetalInstances checks that Metal draws the quads of one draw
|
||||
// (DrawInstances), each with its data and index, as the CPU does.
|
||||
func TestMetalInstances(t *testing.T) {
|
||||
sc := instancesScene(MustCompile(instancesSource))
|
||||
pix, err := metal.RenderOffscreen(sc)
|
||||
if err != nil {
|
||||
t.Skip("no Metal:", err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-metal-instances", pix, sc.Width*4, sc)
|
||||
}
|
||||
Reference in new issue
Block a user