Fix more review
This commit is contained in:
parent
2b60df3d8b
commit
bcf0964c61
3 changed files with 12 additions and 6 deletions
|
@ -886,7 +886,7 @@ void App::GetFileIcon(const base::FilePath& path,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args->GetNext(&callback)) {
|
if (!args->GetNext(&callback)) {
|
||||||
args->ThrowError();
|
args->ThrowError("Missing required callback function");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -405,11 +405,17 @@ You can request the following paths by the name:
|
||||||
|
|
||||||
* `path` String
|
* `path` String
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `size` String - Can be `small`, `normal`, `large`. Except for `large` on _macOS_
|
* `size` String - Can be `small`, `normal`, `large`. The `large` size is not supported on _macOS_
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `error` `Error`
|
* `error` `Error`
|
||||||
* `icon` [NativeImage](native-image.md)
|
* `icon` [NativeImage](native-image.md)
|
||||||
|
|
||||||
|
Fetches associated icon for using OS rules for handling icons.
|
||||||
|
On _Windows_, there a 2 kinds of icons:
|
||||||
|
- icons associated with certain file extension - `.mp3`, `.png`, etc.
|
||||||
|
- icons inside file itself, like `.exe`, `.dll`, `.ico`.
|
||||||
|
On _Linux_ and _macOS_, icons depend on application associated with file mime type.
|
||||||
|
|
||||||
### `app.setPath(name, path)`
|
### `app.setPath(name, path)`
|
||||||
|
|
||||||
* `name` String
|
* `name` String
|
||||||
|
|
|
@ -458,7 +458,7 @@ describe('app module', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('getFileIcon() API', function () {
|
describe('getFileIcon() API', function () {
|
||||||
const iconPath = path.join(process.cwd(), 'fixtures/assets/icon.ico')
|
const iconPath = path.join(__dirname, 'fixtures/assets/icon.ico')
|
||||||
const sizes = {
|
const sizes = {
|
||||||
small: 16,
|
small: 16,
|
||||||
normal: 32,
|
normal: 32,
|
||||||
|
@ -484,7 +484,7 @@ describe('app module', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('size option', function () {
|
describe('size option', function () {
|
||||||
it('fetches small icons', function (done) {
|
it('fetches small icon', function (done) {
|
||||||
app.getFileIcon(iconPath, { size: 'small' }, function (err, icon) {
|
app.getFileIcon(iconPath, { size: 'small' }, function (err, icon) {
|
||||||
const size = icon.getSize()
|
const size = icon.getSize()
|
||||||
assert.equal(err, null)
|
assert.equal(err, null)
|
||||||
|
@ -494,7 +494,7 @@ describe('app module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('fetches normal icons', function (done) {
|
it('fetches normal icon', function (done) {
|
||||||
app.getFileIcon(iconPath, { size: 'normal' }, function (err, icon) {
|
app.getFileIcon(iconPath, { size: 'normal' }, function (err, icon) {
|
||||||
const size = icon.getSize()
|
const size = icon.getSize()
|
||||||
assert.equal(err, null)
|
assert.equal(err, null)
|
||||||
|
@ -504,7 +504,7 @@ describe('app module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('fetches large icons', function (done) {
|
it('fetches large icon', function (done) {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
return this.skip() // macOS does not support large icons
|
return this.skip() // macOS does not support large icons
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue