Merge pull request #7295 from electron/native-image-bad-path-docs
Mention createFromPath bad path return value
This commit is contained in:
commit
c9a3ab3a81
2 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
Loading…
Reference in a new issue