Add app details and icon cache (T-204)
Harness governance / validate (push) Has been cancelled
Phase 0 build gate / verify (push) Has been cancelled

This commit is contained in:
ila
2026-07-16 17:22:37 +08:00
parent db8d93e843
commit a52acbf926
13 changed files with 1224 additions and 58 deletions
+32
View File
@@ -77,6 +77,38 @@ func TestAppShellKeepsRowControlsByAppID(t *testing.T) {
}
}
func TestAppShellRendersSelectedDetailAndAppliedIcon(t *testing.T) {
item := application.CatalogListItem{
ID: "json-parser",
Name: "JSON解析工具",
Description: "格式化并检查 JSON",
Version: "1.2.0",
Category: "开发工具",
Tags: []string{"JSON", "格式化"},
Homepage: "https://example.invalid/json-parser",
Tutorial: "https://example.invalid/json-parser/tutorial",
Status: domain.StatusInstalled,
Installed: true,
}
shell := NewAppShell("Legacy", item)
icon := image.NewNRGBA(image.Rect(0, 0, 32, 32))
shell.ApplyIcon(item.ID, icon)
shell.model.Select(item.ID)
shell.Layout(testContext(image.Pt(1200, 760)), NewTheme())
if !shell.detailRendered {
t.Fatal("selected app detail was not rendered")
}
if _, exists := shell.icons[item.ID]; !exists {
t.Fatal("ApplyIcon did not retain the prepared image operation")
}
shell.ApplyIcon(item.ID, nil)
if _, exists := shell.icons[item.ID]; exists {
t.Fatal("ApplyIcon(nil) did not remove the image")
}
}
func testContext(size image.Point) layout.Context {
var operations op.Ops
return layout.Context{