Add app details and icon cache (T-204)
This commit is contained in:
@@ -79,6 +79,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("Modern", 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(1280, 800)), 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{
|
||||
|
||||
Reference in New Issue
Block a user