diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-15 18:03:29 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-15 18:03:29 +0200 |
| commit | 03784b2024436827de25515b1d85d9ffdde40745 (patch) | |
| tree | bbd1d9264a83a5ea6ad359fe699b622ec15386bb /internal/notify/service_test.go | |
| parent | 7a6b1c1ada3ba6ca2ca4ed70cf51f2f5f30d7b1e (diff) | |
| download | notifyd-03784b2024436827de25515b1d85d9ffdde40745.tar.gz notifyd-03784b2024436827de25515b1d85d9ffdde40745.zip | |
feat(notify): materialise notification images
Notify resolves app_icon and image-path theme names, decodes image-data to
a PNG under the image directory, and re-publishes the entry with its
image path. The daemon advertises body-images, and removeImage refuses to
touch a path outside its own directory so a client's screenshot file is
never deleted.
Diffstat (limited to 'internal/notify/service_test.go')
| -rw-r--r-- | internal/notify/service_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/notify/service_test.go b/internal/notify/service_test.go index 871a0c7..735d01c 100644 --- a/internal/notify/service_test.go +++ b/internal/notify/service_test.go @@ -67,6 +67,35 @@ func TestIdentityAndCapabilities(t *testing.T) { } } +func TestCapabilitiesIncludeBodyImages(t *testing.T) { + caps, err := NewService(nil, t.TempDir()).GetCapabilities() + if err != nil { + t.Fatal(err) + } + found := false + for _, c := range caps { + if c == "body-images" { + found = true + } + } + if !found { + t.Fatalf("body-images missing from %v", caps) + } +} + +func TestNotifyPublishesImagePath(t *testing.T) { + var live []Popup + s := &Service{dir: t.TempDir(), timers: map[uint32]*time.Timer{}} + s.store = NewStore(s.emitClosed, func(l, _ []Popup) { live = l }, s.removeImage) + hints := map[string]dbus.Variant{"image-path": dbus.MakeVariant("/tmp/shot.png")} + if _, err := s.Notify("t", 0, "", "s", "b", nil, hints, -1); err != nil { + t.Fatal(err) + } + if len(live) != 1 || live[0].Image != "/tmp/shot.png" { + t.Fatalf("published %+v", live) + } +} + func TestNotifyReturnsAnIDAndPublishes(t *testing.T) { conn := busOrSkip(t) dir := t.TempDir() |
