Files
magpie/internal/gui/panel_options_test.go
T
yetone 4455c7f998 gui: the Windows tray panel no longer shows a faint close X over its Settings gear — its caption buttons are hidden there (#238 mintonight: a blurry red X at the panel's top-right corner, just above and right of the gear) — Wails v3 makes a frameless window on Windows WS_OVERLAPPEDWINDOW and, for the shadow and round corners, extends DWM's frame into the whole client area; the panel left its close button at the zero value, ButtonEnabled, which sets WS_SYSMENU, so DWM drew the caption's close X into that extended frame at the window's top right, and with the panel translucent (BackgroundTypeTranslucent, WS_EX_NOREDIRECTIONBITMAP, a see-through webview) it showed through the page, faint, over the gear. It was not the page: #winclose is removed everywhere but Linux's window, and is a grey pill in the header row. The panel's options move into panelOptions(goos, theme), unchanged, and on Windows its close, minimise and maximise buttons are ButtonHidden, which takes WS_SYSMENU and the min/max boxes off, so DWM has no caption buttons to draw; DisableFramelessWindowDecorations stays off, so the shadow and Windows 11's round corners stay. The Mac and Linux get the same options as before (their button states left at the zero value), and the main window is not touched. Tested with a new internal/gui/panel_options_test.go (!nogui): on windows the three buttons are hidden and the panel still frameless, translucent, off the taskbar and decorated; on darwin and linux the buttons are as before and URL, backdrop and corner radius unchanged; run on the Mac and compiled for Windows (GOOS=windows go test -c). go build -tags nogui (and GOOS=linux), GOOS=windows go build and go test -tags nogui ./... pass (TestUserPath, TestClaudeSignedOut and TestClaudeAccountNamedAsItsLogin timed out once at a load average near 60 and pass alone). Not tried on a real Windows desktop: that DWM stops drawing the X without WS_SYSMENU is from the Win32 custom-frame behaviour and Wails' code, not seen.
2026-09-30 02:15:48 +08:00

35 lines
1.6 KiB
Go

//go:build !nogui
package gui
import (
"testing"
"github.com/wailsapp/wails/v3/pkg/application"
)
// #238: on Windows the frameless, translucent panel showed DWM's caption
// close X at its top right; its caption buttons are hidden there (no
// WS_SYSMENU), and left as they were on the Mac and Linux.
func TestPanelOptionsCaptionButtons(t *testing.T) {
w := panelOptions("windows", "")
if !w.Frameless || w.BackgroundType != application.BackgroundTypeTranslucent || !w.Windows.HiddenOnTaskbar {
t.Fatalf("windows panel lost its frameless, translucent, off-taskbar options: %+v", w)
}
if w.CloseButtonState != application.ButtonHidden || w.MinimiseButtonState != application.ButtonHidden || w.MaximiseButtonState != application.ButtonHidden {
t.Errorf("windows panel caption buttons = close %v min %v max %v, want all hidden", w.CloseButtonState, w.MinimiseButtonState, w.MaximiseButtonState)
}
if w.Windows.DisableFramelessWindowDecorations {
t.Errorf("windows panel should keep its shadow and round corners")
}
for _, goos := range []string{"darwin", "linux"} {
o := panelOptions(goos, "&theme=dark")
if o.CloseButtonState != application.ButtonEnabled || o.MinimiseButtonState != application.ButtonEnabled || o.MaximiseButtonState != application.ButtonEnabled {
t.Errorf("%s panel caption buttons changed: close %v min %v max %v", goos, o.CloseButtonState, o.MinimiseButtonState, o.MaximiseButtonState)
}
if o.URL != "/?mode=panel&theme=dark" || !o.Frameless || o.Mac.CornerRadius != 12 || o.Mac.Backdrop != application.MacBackdropTranslucent {
t.Errorf("%s panel options changed: %+v", goos, o)
}
}
}