From af54c5a4b6c9d022045d6f01a068fe62cb196565 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 25 Sep 2024 06:17:27 -0500 Subject: [PATCH] test: add tests dbus notification images (#43938) Provide a NativeImage icon in the notification tests and then inspect the DBus message payload's `image_data` hint to see if it's correct. This adds test coverage for LibnotifyNotification::Show() and for GdkPixbufFromSkBitmap(). --- spec/api-notification-dbus-spec.ts | 6 ++++++ spec/fixtures/assets/notification_icon.png | Bin 0 -> 107 bytes 2 files changed, 6 insertions(+) create mode 100644 spec/fixtures/assets/notification_icon.png diff --git a/spec/api-notification-dbus-spec.ts b/spec/api-notification-dbus-spec.ts index 26e50e9bf3ae..3d359a307b37 100644 --- a/spec/api-notification-dbus-spec.ts +++ b/spec/api-notification-dbus-spec.ts @@ -9,8 +9,12 @@ import { expect } from 'chai'; import * as dbus from 'dbus-native'; import { app } from 'electron/main'; +import { nativeImage } from 'electron/common'; import { ifdescribe } from './lib/spec-helpers'; import { promisify } from 'node:util'; +import * as path from 'node:path'; + +const fixturesPath = path.join(__dirname, 'fixtures'); const skip = process.platform !== 'linux' || process.arch === 'ia32' || @@ -92,6 +96,7 @@ ifdescribe(!skip)('Notification module (dbus)', () => { title: 'title', subtitle: 'subtitle', body: 'body', + icon: nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'notification_icon.png')), replyPlaceholder: 'replyPlaceholder', sound: 'sound', closeButtonText: 'closeButtonText' @@ -117,6 +122,7 @@ ifdescribe(!skip)('Notification module (dbus)', () => { actions: [], hints: { append: 'true', + image_data: [3, 3, 12, true, 8, 4, Buffer.from([255, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 0, 76, 255, 0, 255, 0, 0, 0, 255, 0, 0, 0, 0, 0, 38, 255, 255, 0, 0, 0, 255, 0, 0, 0, 0])], 'desktop-entry': appName, urgency: 1 } diff --git a/spec/fixtures/assets/notification_icon.png b/spec/fixtures/assets/notification_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cc2d1554049ee4b895dfbe0b9d530b4139f04dac GIT binary patch literal 107 zcmeAS@N?(olHy`uVBq!ia0vp^%plCc1|-8Yw(bW~MxHK?Asn)d>I^sjGyG=&AuwiO f@&z&BK