Merge pull request #7295 from electron/native-image-bad-path-docs

Mention createFromPath bad path return value
This commit is contained in:
Cheng Zhao 2016-09-22 14:14:15 +09:00 committed by GitHub
commit c9a3ab3a81
2 changed files with 5 additions and 1 deletions

View file

@ -120,7 +120,9 @@ Creates an empty `NativeImage` instance.
* `path` String
Creates a new `NativeImage` instance from a file located at `path`.
Creates a new `NativeImage` instance from a file located at `path`. This method
returns an empty image if the `path` does not exist, cannot be read, or is not
a valid image.
```javascript
const nativeImage = require('electron').nativeImage

View file

@ -10,6 +10,8 @@ describe('nativeImage module', () => {
assert(nativeImage.createFromPath('').isEmpty())
assert(nativeImage.createFromPath('does-not-exist.png').isEmpty())
assert(nativeImage.createFromPath('does-not-exist.ico').isEmpty())
assert(nativeImage.createFromPath(__dirname).isEmpty())
assert(nativeImage.createFromPath(__filename).isEmpty())
})
it('loads images from paths relative to the current working directory', () => {