aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--internal/notify/classify.go8
-rw-r--r--internal/notify/classify_test.go6
2 files changed, 10 insertions, 4 deletions
diff --git a/internal/notify/classify.go b/internal/notify/classify.go
index c7e0dc8..d00a7fa 100644
--- a/internal/notify/classify.go
+++ b/internal/notify/classify.go
@@ -21,10 +21,10 @@ import (
"strings"
)
-// IconMaxPixels is the long-side bound below which a content image is treated
-// as an icon rather than a preview. A screenshot is far larger; a themed icon
-// or an application logo is not.
-const IconMaxPixels = 128
+// IconMaxPixels is the long-side bound at or below which a content image is
+// treated as an icon rather than a preview. A themed icon or an application
+// logo is 256 or less; a screenshot is far larger.
+const IconMaxPixels = 256
// IsIconImage reports whether a content image should fill the app-icon slot
// instead of the large preview. Clients disagree about where the icon goes:
diff --git a/internal/notify/classify_test.go b/internal/notify/classify_test.go
index 6234008..bbe7989 100644
--- a/internal/notify/classify_test.go
+++ b/internal/notify/classify_test.go
@@ -39,8 +39,12 @@ func TestIsIconImage(t *testing.T) {
small := filepath.Join(dir, "logo.png")
large := filepath.Join(dir, "shot.png")
svg := filepath.Join(dir, "icon.svg")
+ exactly := filepath.Join(dir, "256.png")
+ over := filepath.Join(dir, "over.png")
writeTestPNG(t, small, 32, 32)
writeTestPNG(t, large, 800, 600)
+ writeTestPNG(t, exactly, 256, 256)
+ writeTestPNG(t, over, 256, 257)
if err := os.WriteFile(svg, []byte("<svg/>"), 0o644); err != nil {
t.Fatal(err)
}
@@ -52,6 +56,8 @@ func TestIsIconImage(t *testing.T) {
{"theme name", "utilities-terminal", "/x/apps/16/utilities-terminal.svg", true},
{"svg", svg, svg, true},
{"small raster", small, small, true},
+ {"at the bound", exactly, exactly, true},
+ {"just over the bound", over, over, false},
{"large raster", large, large, false},
{"missing file", "/no/such.png", "/no/such.png", false},
{"empty", "", "", false},