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().
This commit is contained in:
parent
bcf4095ace
commit
af54c5a4b6
2 changed files with 6 additions and 0 deletions
|
@ -9,8 +9,12 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import * as dbus from 'dbus-native';
|
import * as dbus from 'dbus-native';
|
||||||
import { app } from 'electron/main';
|
import { app } from 'electron/main';
|
||||||
|
import { nativeImage } from 'electron/common';
|
||||||
import { ifdescribe } from './lib/spec-helpers';
|
import { ifdescribe } from './lib/spec-helpers';
|
||||||
import { promisify } from 'node:util';
|
import { promisify } from 'node:util';
|
||||||
|
import * as path from 'node:path';
|
||||||
|
|
||||||
|
const fixturesPath = path.join(__dirname, 'fixtures');
|
||||||
|
|
||||||
const skip = process.platform !== 'linux' ||
|
const skip = process.platform !== 'linux' ||
|
||||||
process.arch === 'ia32' ||
|
process.arch === 'ia32' ||
|
||||||
|
@ -92,6 +96,7 @@ ifdescribe(!skip)('Notification module (dbus)', () => {
|
||||||
title: 'title',
|
title: 'title',
|
||||||
subtitle: 'subtitle',
|
subtitle: 'subtitle',
|
||||||
body: 'body',
|
body: 'body',
|
||||||
|
icon: nativeImage.createFromPath(path.join(fixturesPath, 'assets', 'notification_icon.png')),
|
||||||
replyPlaceholder: 'replyPlaceholder',
|
replyPlaceholder: 'replyPlaceholder',
|
||||||
sound: 'sound',
|
sound: 'sound',
|
||||||
closeButtonText: 'closeButtonText'
|
closeButtonText: 'closeButtonText'
|
||||||
|
@ -117,6 +122,7 @@ ifdescribe(!skip)('Notification module (dbus)', () => {
|
||||||
actions: [],
|
actions: [],
|
||||||
hints: {
|
hints: {
|
||||||
append: 'true',
|
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,
|
'desktop-entry': appName,
|
||||||
urgency: 1
|
urgency: 1
|
||||||
}
|
}
|
||||||
|
|
BIN
spec/fixtures/assets/notification_icon.png
vendored
Normal file
BIN
spec/fixtures/assets/notification_icon.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 107 B |
Loading…
Reference in a new issue