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
@@ -0,0 +1,80 @@
|
||||
package raster
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/egoist/mygo/internal/scene"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTransformedSceneDamageAndNestedClips(t *testing.T) {
|
||||
s := &scene.Scene{Width: 150, Height: 100}
|
||||
m := scene.Translation(70, 20).Mul(scene.Rotation(90))
|
||||
s.Ops = []scene.Op{
|
||||
{Kind: scene.OpPushClip, Rect: scene.Rect{W: 60, H: 40}, Transform: m},
|
||||
{Kind: scene.OpPushClip, Rect: scene.Rect{X: 5, Y: 5, W: 30, H: 20}, Transform: m, Radii: [4]float32{4, 4, 4, 4}},
|
||||
{Kind: scene.OpFill, Rect: scene.Rect{W: 100, H: 100}, Color: scene.Color{R: 255, A: 255}, Transform: m},
|
||||
{Kind: scene.OpPopClip}, {Kind: scene.OpPopClip},
|
||||
}
|
||||
var r Renderer
|
||||
defer r.Release()
|
||||
r.Render(s)
|
||||
p := r.Image.Pix[35*r.Image.Stride+4*55:][:4]
|
||||
if p[2] != 255 || p[3] != 255 {
|
||||
t.Fatalf("transformed clip interior: %v", p)
|
||||
}
|
||||
p = r.Image.Pix[30*r.Image.Stride+4*35:][:4]
|
||||
if p[3] != 0 {
|
||||
t.Fatal("paint escaped rotated clips")
|
||||
}
|
||||
if damage := r.Render(s); len(damage) != 0 {
|
||||
t.Fatalf("unchanged scene damaged %v", damage)
|
||||
}
|
||||
for i := range s.Ops {
|
||||
s.Ops[i].Transform = scene.Translation(20, 0).Mul(s.Ops[i].Transform)
|
||||
}
|
||||
r.Render(s)
|
||||
want := NewImage(s.Width, s.Height)
|
||||
Render(want, s)
|
||||
if !bytes.Equal(r.Image.Pix, want.Pix) {
|
||||
t.Fatal("incremental transformed drawing differs from full drawing")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTransformedThinBorderGradientAndImage(t *testing.T) {
|
||||
s := &scene.Scene{Width: 100, Height: 100}
|
||||
s.Ops = []scene.Op{{Kind: scene.OpFill, Rect: scene.Rect{W: 10, H: 10}, Color: scene.Color{R: 255, A: 255}, Color2: scene.Color{B: 255, A: 255}, Paint: scene.PaintLinear, Gradient: [4]float32{0, 0, 10, 0}, Border: scene.Uniform(1), BorderColor: scene.Color{G: 255, A: 255}, Transform: scene.Translation(20, 20).Mul(scene.Scaling(3, 2))}}
|
||||
m := NewImage(100, 100)
|
||||
Render(m, s)
|
||||
at := func(x, y int) []byte { return m.Pix[y*m.Stride+4*x:][:4] }
|
||||
if at(21, 30)[1] != 255 {
|
||||
t.Fatalf("scaled border: %v", at(21, 30))
|
||||
}
|
||||
if p := at(35, 30); p[0] < 100 || p[2] < 100 || p[1] != 0 {
|
||||
t.Fatalf("gradient not sampled locally: %v", p)
|
||||
}
|
||||
img := scene.NewImageRGBA(2, 1, []byte{255, 0, 0, 255, 0, 0, 255, 255})
|
||||
s.Ops = []scene.Op{{Kind: scene.OpImage, Rect: scene.Rect{W: 20, H: 10}, Src: scene.Rect{W: 2, H: 1}, Image: img, Transform: scene.Translation(50, 20).Mul(scene.Rotation(90))}}
|
||||
Render(m, s)
|
||||
if at(45, 21)[2] < 240 || at(45, 38)[0] < 240 {
|
||||
t.Fatalf("rotated image colors: %v %v", at(45, 21), at(45, 38))
|
||||
}
|
||||
}
|
||||
|
||||
// TestTransformedImageDrawsReleasedPixels checks that an image whose owner
|
||||
// dropped its pixels (Bitmap.ReleasePixels) still draws with a transform:
|
||||
// the op reads Pix, which the renderer must make again, as it does for an
|
||||
// image drawn without one.
|
||||
func TestTransformedImageDrawsReleasedPixels(t *testing.T) {
|
||||
s := &scene.Scene{Width: 100, Height: 100}
|
||||
img := scene.NewImageRGBA(2, 1, []byte{255, 0, 0, 255, 0, 0, 255, 255})
|
||||
img.Restore = func() []byte { return []byte{255, 0, 0, 255, 0, 0, 255, 255} }
|
||||
img.Dropped = func() { img.Pix = nil }
|
||||
img.Dropped()
|
||||
s.Ops = []scene.Op{{Kind: scene.OpImage, Rect: scene.Rect{W: 20, H: 10}, Src: scene.Rect{W: 2, H: 1}, Image: img, Transform: scene.Translation(50, 20).Mul(scene.Rotation(90))}}
|
||||
m := NewImage(100, 100)
|
||||
Render(m, s)
|
||||
at := func(x, y int) []byte { return m.Pix[y*m.Stride+4*x:][:4] }
|
||||
if at(45, 21)[2] < 240 || at(45, 38)[0] < 240 {
|
||||
t.Fatalf("rotated image colors: %v %v", at(45, 21), at(45, 38))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user