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.
56 lines
1.7 KiB
Go
56 lines
1.7 KiB
Go
//go:build windows && (amd64 || arm64)
|
|
|
|
package windows
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
"testing"
|
|
"unsafe"
|
|
)
|
|
|
|
// TestFileIconAlpha checks that the shell's icons come with straight
|
|
// alpha, as imageOfDIB takes them: the colors of partly transparent
|
|
// pixels go above their alpha, which premultiplied ones never do.
|
|
func TestFileIconAlpha(t *testing.T) {
|
|
runtime.LockOSThread()
|
|
defer runtime.UnlockOSThread()
|
|
procCoInitializeEx.Call(0, coinitApartmentThreaded)
|
|
paths := []string{
|
|
filepath.Join(os.Getenv("SystemRoot"), "System32", "notepad.exe"),
|
|
filepath.Join(os.Getenv("SystemRoot"), "explorer.exe"),
|
|
os.Getenv("SystemRoot"),
|
|
}
|
|
for _, path := range paths {
|
|
var factory uintptr
|
|
if r, _, _ := procSHCreateItemFromParsingName.Call(uintptr(unsafe.Pointer(u16(path))), 0, uintptr(unsafe.Pointer(&iidIShellItemImageFactory)), uintptr(unsafe.Pointer(&factory))); failed(r) {
|
|
t.Fatalf("%s: %#x", path, r)
|
|
}
|
|
var hbm uintptr
|
|
if r := comCall(factory, 3, uintptr(48)|uintptr(48)<<32, 0x4, uintptr(unsafe.Pointer(&hbm))); failed(r) {
|
|
t.Fatalf("%s: GetImage %#x", path, r)
|
|
}
|
|
release(factory)
|
|
img, err := imageOfDIB(hbm)
|
|
procDeleteObject.Call(hbm)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
partial, over := 0, 0
|
|
for i := 0; i < len(img.Pix); i += 4 {
|
|
r, g, b, a := img.Pix[i], img.Pix[i+1], img.Pix[i+2], img.Pix[i+3]
|
|
if a > 0 && a < 255 {
|
|
partial++
|
|
}
|
|
if r > a || g > a || b > a {
|
|
over++
|
|
}
|
|
}
|
|
t.Logf("%s: %dx%d, %d partly transparent pixels, %d above their alpha", path, img.Rect.Dx(), img.Rect.Dy(), partial, over)
|
|
if partial > 0 && over == 0 {
|
|
t.Errorf("%s: no partly transparent pixel has a channel above its alpha: premultiplied?", path)
|
|
}
|
|
}
|
|
}
|