From ed25941c650a591469441d9e9a3cbd5d5be22c80 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 10 Oct 2017 17:30:27 +1100 Subject: [PATCH] Add basic specs --- spec/api-native-image-spec.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/spec/api-native-image-spec.js b/spec/api-native-image-spec.js index 9b8e5c3a2e0..59c204094fb 100644 --- a/spec/api-native-image-spec.js +++ b/spec/api-native-image-spec.js @@ -190,6 +190,34 @@ describe('nativeImage module', () => { }) }) + describe('createFromNamedImage(name)', () => { + it('returns empty for invalid options', () => { + const image = nativeImage.createFromNamedImage('totally_not_real') + assert(image.isEmpty()) + }) + + it('returns empty on non-darwin platforms', () => { + if (process.platform === 'darwin') return + + const image = nativeImage.createFromNamedImage('NSActionTemplate') + assert(image.isEmpty()) + }) + + it('returns a valid image on darwin', () => { + if (process.platform !== 'darwin') return + + const image = nativeImage.createFromNamedImage('NSActionTemplate') + assert(!image.isEmpty()) + }) + + it('returns allows an HSL shift for a valid image on darwin', () => { + if (process.platform !== 'darwin') return + + const image = nativeImage.createFromNamedImage('NSActionTemplate', [0.5, 0.2, 0.8]) + assert(!image.isEmpty()) + }) + }) + describe('resize(options)', () => { it('returns a resized image', () => { const image = nativeImage.createFromPath(path.join(__dirname, 'fixtures', 'assets', 'logo.png'))