Files
magpie/internal/cli/winres_test.go
T
yetone 712d3c20ae build: the Windows app's icon group is resource 3, the one Wails gives its window, so the taskbar shows the bird and not a blank page (#1777)
Wails v3 sets a Windows window's icon from the icon group with numeric
resource ID 3 (NewIconFromResource(GetModuleHandle(""), 3) in
webview_window_windows.go). build/windows/winres.json named the group
"APP", and go-winres makes a numeric ID only of a "#n" key, so the exe
had no group 3: the window got no icon, and the taskbar and Alt-Tab drew
Windows' blank page. The group is now "#3".

internal/cli/winres_test.go fails while the group isn't under "#3".

Run:
- go-winres v0.3.3 make as the Makefile's release-windows, an amd64 build
  of each on the Windows box (yeton@10.0.0.132): the new exe has group 3
  and LoadImage(3) succeeds; the old one has neither.
- TestWindowsIconIsResourceThree red on the old winres.json, green now.
- gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., sandboxed go test ./... at the rebased head.
Not run: the taskbar of the running app seen with the eye; the release
build (signed) wasn't made.
2026-10-12 22:55:22 +08:00

32 lines
889 B
Go

package cli
import (
"encoding/json"
"os"
"testing"
)
// Wails gives a Windows window the icon group whose numeric resource ID is
// 3 (NewIconFromResource(GetModuleHandle(""), 3) in its
// webview_window_windows.go), and go-winres makes a numeric ID only of a
// "#n" key. Named "APP", the group had no ID 3, so the taskbar and Alt-Tab
// showed Windows' blank page instead of the bird (#1777).
func TestWindowsIconIsResourceThree(t *testing.T) {
b, err := os.ReadFile("../../build/windows/winres.json")
if err != nil {
t.Fatal(err)
}
var res map[string]map[string]json.RawMessage
if err := json.Unmarshal(b, &res); err != nil {
t.Fatal(err)
}
groups := res["RT_GROUP_ICON"]
if _, ok := groups["#3"]; !ok {
names := []string{}
for k := range groups {
names = append(names, k)
}
t.Fatalf("RT_GROUP_ICON has %q, want the window's icon under \"#3\"", names)
}
}