Harden icon cache concurrency (T-606)

This commit is contained in:
ila
2026-07-17 09:38:25 +08:00
parent 8873a5261d
commit f1cc7308db
17 changed files with 835 additions and 60 deletions
+12
View File
@@ -61,6 +61,8 @@ func TestAppShellKeepsRowControlsByAppID(t *testing.T) {
}
shell := NewAppShell("Modern", items...)
original := shell.rows["app-two"]
shell.ApplyIcon("app-one", image.NewNRGBA(image.Rect(0, 0, 16, 16)))
shell.ApplyIcon("app-two", image.NewNRGBA(image.Rect(0, 0, 24, 24)))
shell.model.SetCategory("图像")
shell.Layout(testContext(image.Pt(1080, 720)), NewTheme())
@@ -77,6 +79,16 @@ func TestAppShellKeepsRowControlsByAppID(t *testing.T) {
if _, exists := shell.rows["app-one"]; exists {
t.Fatal("removed app retained row controls")
}
if _, exists := shell.icons["app-one"]; exists {
t.Fatal("removed app retained prepared icon")
}
icon, exists := shell.icons["app-two"]
if !exists {
t.Fatal("retained app lost its prepared icon")
}
if icon.Size() != image.Pt(24, 24) {
t.Fatalf("retained app icon size = %v", icon.Size())
}
}
func TestAppShellRendersSelectedDetailAndAppliedIcon(t *testing.T) {