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.
81 lines
2.8 KiB
Go
81 lines
2.8 KiB
Go
//go:build windows
|
|
|
|
package d3d11
|
|
|
|
import (
|
|
"runtime"
|
|
"testing"
|
|
|
|
"github.com/egoist/mygo/internal/raster"
|
|
"github.com/egoist/mygo/internal/scene"
|
|
)
|
|
|
|
// A stationary or translated rounded card clips its content and hard children without uploading a whole-card mask.
|
|
func TestRoundedCardClipsTransformedContentWithoutMask(t *testing.T) {
|
|
runtime.LockOSThread()
|
|
defer runtime.UnlockOSThread()
|
|
hwnd, err := newHiddenWindow(192, 160)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer destroyWindow(hwnd)
|
|
r, err := New(hwnd)
|
|
if err != nil {
|
|
t.Skip("Direct3D 11 unavailable:", err)
|
|
}
|
|
defer r.Release()
|
|
for _, moved := range []bool{false, true} {
|
|
move := scene.Affine{}
|
|
if moved {
|
|
move = scene.Translation(5, 7)
|
|
}
|
|
for _, inner := range []bool{false, true} {
|
|
for _, transform := range []scene.Affine{{}, scene.Scaling(1.01, 1.01), scene.Rotation(11), scene.Projective(1, 0, 0, 1, 20, 15, 0.001, 0.0004)} {
|
|
s := &scene.Scene{Width: 192, Height: 160, Clear: scene.Color{A: 255}}
|
|
s.Ops = append(s.Ops, scene.Op{Kind: scene.OpPushClip, Rect: scene.Rect{X: 13, Y: 11, W: 133, H: 117}, Radii: [4]float32{19, 19, 19, 19}, Transform: move})
|
|
if inner {
|
|
// #1418: a hard child reaching into its rounded parent's
|
|
// bottom corners must retain those corners; #1420 also
|
|
// folds a shared translation into the clips' frame positions.
|
|
s.Ops = append(s.Ops, scene.Op{Kind: scene.OpPushClip, Rect: scene.Rect{X: 13, Y: 70, W: 133, H: 58}, Transform: move})
|
|
}
|
|
s.Ops = append(s.Ops, scene.Op{Kind: scene.OpFill, Rect: scene.Rect{W: 190, H: 150}, Color: scene.Color{R: 255, G: 255, B: 255, A: 255}, Transform: transform})
|
|
if inner {
|
|
s.Ops = append(s.Ops, scene.Op{Kind: scene.OpPopClip})
|
|
}
|
|
s.Ops = append(s.Ops, scene.Op{Kind: scene.OpPopClip})
|
|
if err := r.draw(s); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(r.images) != 0 {
|
|
t.Fatalf("moved=%t inner=%t transform=%v: rounded card uploaded %d mask textures", moved, inner, transform, len(r.images))
|
|
}
|
|
pix, stride, err := r.read()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
ref := raster.NewImage(s.Width, s.Height)
|
|
raster.Render(ref, s)
|
|
maxDiff, totalDiff := 0, 0
|
|
for y := range s.Height {
|
|
for x := range s.Width {
|
|
// This grayscale fixture has equal RGB channels in BGRA and RGBA.
|
|
d := int(pix[y*stride+4*x]) - int(ref.Pix[y*ref.Stride+4*x])
|
|
if d < 0 {
|
|
d = -d
|
|
}
|
|
maxDiff = max(maxDiff, d)
|
|
totalDiff += d
|
|
}
|
|
}
|
|
if maxDiff > 20 || float64(totalDiff)/float64(s.Width*s.Height) > 0.2 {
|
|
t.Fatalf("moved=%t inner=%t transform=%v: rounded coverage differs from CPU: max=%d mean=%f", moved, inner, transform, maxDiff, float64(totalDiff)/float64(s.Width*s.Height))
|
|
}
|
|
if err := r.present(0); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|