2016-01-27 02:22:22 +00:00
|
|
|
// need to subtract 2 from source maps
|
|
|
|
import 'source-map-support/register';
|
|
|
|
|
|
|
|
import chai from 'chai';
|
|
|
|
import fs from 'fs';
|
2016-01-28 14:43:43 +00:00
|
|
|
import os from 'os';
|
2016-01-27 02:22:22 +00:00
|
|
|
import path from 'path';
|
2016-01-28 02:00:28 +00:00
|
|
|
import pngToIcns from './../../lib/pngToIcns';
|
2016-01-27 02:22:22 +00:00
|
|
|
|
|
|
|
let assert = chai.assert;
|
|
|
|
|
2016-01-28 14:43:43 +00:00
|
|
|
// Prerequisite for test: to use OSX with sips, iconutil and imagemagick convert
|
|
|
|
|
2016-01-27 02:22:22 +00:00
|
|
|
function testConvertPng(pngName, done) {
|
2016-01-28 14:43:43 +00:00
|
|
|
if (os.platform() !== 'darwin') {
|
|
|
|
console.warn('Skipping png conversion tests, OSX is required');
|
|
|
|
done();
|
|
|
|
}
|
2016-01-27 02:22:22 +00:00
|
|
|
pngToIcns(path.join(__dirname, '../../', 'test-resources', pngName), (error, icnsPath) => {
|
|
|
|
if (error) {
|
|
|
|
done(error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
let stat = fs.statSync(icnsPath);
|
2016-01-28 03:47:40 +00:00
|
|
|
assert.isTrue(stat.isFile(), 'Output icns file should be a path');
|
2016-01-27 02:22:22 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
describe('Get Icon Module', function() {
|
|
|
|
it('Can convert a rgb png to icns', function(done) {
|
|
|
|
testConvertPng('iconSample.png', done);
|
|
|
|
});
|
2016-01-28 03:47:40 +00:00
|
|
|
|
2016-01-27 02:22:22 +00:00
|
|
|
it('Can convert a grey png to icns', function(done) {
|
|
|
|
testConvertPng('iconSampleGrey.png', done);
|
|
|
|
});
|
|
|
|
});
|