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
+156
@@ -0,0 +1,156 @@
|
||||
//go:build (amd64 || arm64) && !android
|
||||
|
||||
package shader
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/egoist/mygo/internal/gpu/gl"
|
||||
"github.com/egoist/mygo/internal/gpu/gputest"
|
||||
)
|
||||
|
||||
// TestOpenGL checks that OpenGL 3.3 and OpenGL ES 3.0 draw a shader, its
|
||||
// uniforms and its images, a bitmap and a canvas, as the CPU does.
|
||||
func TestOpenGL(t *testing.T) {
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
s := MustCompile(testSource)
|
||||
for _, es := range []bool{false, true} {
|
||||
sc := testScene(s)
|
||||
o, err := gl.NewOffscreen(es, sc.Width, sc.Height)
|
||||
if err != nil {
|
||||
t.Skip(err)
|
||||
}
|
||||
t.Log(o.Info())
|
||||
pix, err := o.Render(sc)
|
||||
o.Release()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
name := "ui-shader-gl"
|
||||
if es {
|
||||
name += "-es"
|
||||
}
|
||||
gputest.Compare(t, name, pix, sc.Width*4, sc)
|
||||
}
|
||||
}
|
||||
|
||||
// TestOpenGLBools checks that OpenGL reads bool uniforms as the CPU does.
|
||||
func TestOpenGLBools(t *testing.T) {
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
sc := boolScene()
|
||||
o, err := gl.NewOffscreen(false, sc.Width, sc.Height)
|
||||
if err != nil {
|
||||
t.Skip(err)
|
||||
}
|
||||
defer o.Release()
|
||||
pix, err := o.Render(sc)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-gl-bools", pix, sc.Width*4, sc)
|
||||
}
|
||||
|
||||
// TestOpenGLDfdy checks that dfdy grows downward on OpenGL, in a canvas
|
||||
// and in the frame, whose rows go up.
|
||||
func TestOpenGLDfdy(t *testing.T) {
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
for _, es := range []bool{false, true} {
|
||||
sc := dfdyScene()
|
||||
o, err := gl.NewOffscreen(es, sc.Width, sc.Height)
|
||||
if err != nil {
|
||||
t.Skip(err)
|
||||
}
|
||||
pix, err := o.Render(sc)
|
||||
o.Release()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
checkDfdy(t, pix, sc.Width*4)
|
||||
}
|
||||
}
|
||||
|
||||
// TestOpenGLMasked checks that OpenGL fills mask glyphs with a shader, as
|
||||
// text and paths, as the CPU does.
|
||||
func TestOpenGLMasked(t *testing.T) {
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
for _, es := range []bool{false, true} {
|
||||
sc := maskedScene(MustCompile(maskedSource))
|
||||
o, err := gl.NewOffscreen(es, sc.Width, sc.Height)
|
||||
if err != nil {
|
||||
t.Skip(err)
|
||||
}
|
||||
pix, err := o.Render(sc)
|
||||
o.Release()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-gl-masked", pix, sc.Width*4, sc)
|
||||
}
|
||||
}
|
||||
|
||||
// TestOpenGLEffect checks that OpenGL draws an effect's shader from its
|
||||
// content, as the CPU does.
|
||||
func TestOpenGLEffect(t *testing.T) {
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
for _, es := range []bool{false, true} {
|
||||
for name, sc := range effectScenes(MustCompile(effectSource)) {
|
||||
o, err := gl.NewOffscreen(es, sc.Width, sc.Height)
|
||||
if err != nil {
|
||||
t.Skip(err)
|
||||
}
|
||||
pix, err := o.Render(sc)
|
||||
o.Release()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-gl-effect-"+name, pix, sc.Width*4, sc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestOpenGLBackdrop checks that OpenGL gives a shader its backdrop, as
|
||||
// the CPU does.
|
||||
func TestOpenGLBackdrop(t *testing.T) {
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
for _, es := range []bool{false, true} {
|
||||
for name, sc := range backdropCases() {
|
||||
o, err := gl.NewOffscreen(es, sc.Width, sc.Height)
|
||||
if err != nil {
|
||||
t.Skip(err)
|
||||
}
|
||||
pix, err := o.Render(sc)
|
||||
o.Release()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-gl-backdrop-"+name, pix, sc.Width*4, sc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestOpenGLInstances checks that OpenGL draws the quads of one draw
|
||||
// (DrawInstances), each with its data and index, as the CPU does.
|
||||
func TestOpenGLInstances(t *testing.T) {
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
for _, es := range []bool{false, true} {
|
||||
sc := instancesScene(MustCompile(instancesSource))
|
||||
o, err := gl.NewOffscreen(es, sc.Width, sc.Height)
|
||||
if err != nil {
|
||||
t.Skip(err)
|
||||
}
|
||||
pix, err := o.Render(sc)
|
||||
o.Release()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
gputest.Compare(t, "ui-shader-gl-instances", pix, sc.Width*4, sc)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user