mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-15 19:24:23 +08:00
- 同步主窗口解析后的自定义主题上下文,覆盖独立窗口主题变量和 Ant Design 令牌\n- 使用主题背景绘制 detached WebView,避免透明区域回退为白色\n- 按 macOS、Windows 和 Linux 配置原生窗口透明参数\n- 补充主题通信、覆盖层主题和原生窗口视觉选项回归测试
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
package nativewindow
|
|
|
|
import "testing"
|
|
|
|
func TestResolveDetachedWindowVisualOptionsUsesWebViewSurface(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
goos string
|
|
wantMac bool
|
|
wantLinux bool
|
|
wantWindows bool
|
|
}{
|
|
{name: "macOS", goos: "darwin", wantMac: true},
|
|
{name: "linux", goos: "linux", wantLinux: true},
|
|
{name: "windows", goos: "windows", wantWindows: true},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
visuals := resolveDetachedWindowVisualOptions(test.goos)
|
|
if visuals.backgroundColour == nil || visuals.backgroundColour.A != 0 {
|
|
t.Fatalf("background colour = %#v, want transparent", visuals.backgroundColour)
|
|
}
|
|
if (visuals.mac != nil) != test.wantMac {
|
|
t.Fatalf("mac options present = %t, want %t", visuals.mac != nil, test.wantMac)
|
|
}
|
|
if (visuals.linux != nil) != test.wantLinux {
|
|
t.Fatalf("linux options present = %t, want %t", visuals.linux != nil, test.wantLinux)
|
|
}
|
|
if (visuals.windows != nil) != test.wantWindows {
|
|
t.Fatalf("windows options present = %t, want %t", visuals.windows != nil, test.wantWindows)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestResolveDetachedWindowVisualOptionsKeepsUnknownPlatformsOpaque(t *testing.T) {
|
|
visuals := resolveDetachedWindowVisualOptions("plan9")
|
|
if visuals.backgroundColour == nil || visuals.backgroundColour.A != 255 {
|
|
t.Fatalf("background colour = %#v, want opaque fallback", visuals.backgroundColour)
|
|
}
|
|
}
|