Skip to content

Commit

Permalink
#32 #34 Added an icp4 - icp6
Browse files Browse the repository at this point in the history
  • Loading branch information
akabekobeko committed Jun 22, 2016
1 parent 8acc81e commit de3f595
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/lib/icns-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const IcnsConstants = {
* Sizes required for the ICNS file.
* @type {Array}
*/
imageSizes: [ 32, 64, 128, 256, 512, 1024 ],
imageSizes: [ 16, 32, 64, 128, 256, 512, 1024 ],

/**
* The size of the ICNS header.
Expand All @@ -28,6 +28,9 @@ export const IcnsConstants = {
* @type {Array}
*/
iconIDs: [
{ id: 'icp4', size: 16 },
{ id: 'icp5', size: 32 },
{ id: 'icp6', size: 64 },
{ id: 'ic07', size: 128 },
{ id: 'ic08', size: 256 },
{ id: 'ic09', size: 512 },
Expand Down Expand Up @@ -65,7 +68,8 @@ export default class IcnsGenerator {
for( let i = 0, max = IcnsConstants.iconIDs.length; i < max; ++i ) {
const iconID = IcnsConstants.iconIDs[ i ];
if( !( IcnsGenerator.writeImage( iconID, images, stream ) ) ) {
return reject( new Error( 'Faild to read/write image.' ) );
reject( new Error( 'Faild to read/write image.' ) );
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/lib/icns-generator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe( 'IcnsGenerator', () => {

/** @test {IcnsGenerator#createIconHeader} */
it( 'createIconHeader', () => {
const header = IcnsGenerator.createIconHeader( IcnsConstants.iconIDs[ 0 ], 128 );
const header = IcnsGenerator.createIconHeader( IcnsConstants.iconIDs[ 3 ], 128 );

// In ASCII "ic07"
assert( header.readUInt8( 0 ) === 0x69 );
Expand Down
2 changes: 1 addition & 1 deletion test/lib/icon-generator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe( 'IconGenerator', () => {
assert( expected.length === 7 );

expected = IconGenerator.filter( targets, IcnsConstants.imageSizes );
assert( expected.length === 6 );
assert( expected.length === 7 );

expected = IconGenerator.filter( targets, FaviconConstants.imageSizes );
assert( expected.length === 10 );
Expand Down

0 comments on commit de3f595

Please sign in to comment.