spritesmith
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -24,3 +24,5 @@ module.exports = function(grunt) { | ||
eqnull: true, | ||
node: true | ||
node: true, | ||
strict: false | ||
}, | ||
@@ -27,0 +29,0 @@ globals: { |
{ | ||
"name": "spritesmith", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "Utility that takes images and creates a spritesheet with JSON sprite data", | ||
@@ -5,0 +5,0 @@ "main": "src/smith.js", |
{ | ||
"G:\\spritesmith\\src-test\\test_sprites\\sprite1.png": { | ||
"/home/todd/github/spritesmith/src-test/test_sprites/sprite1.png": { | ||
"x": 0, | ||
@@ -8,3 +8,3 @@ "y": 0, | ||
}, | ||
"G:\\spritesmith\\src-test\\test_sprites\\sprite2.jpg": { | ||
"/home/todd/github/spritesmith/src-test/test_sprites/sprite2.jpg": { | ||
"x": 50, | ||
@@ -15,3 +15,3 @@ "y": 0, | ||
}, | ||
"G:\\spritesmith\\src-test\\test_sprites\\sprite3.png": { | ||
"/home/todd/github/spritesmith/src-test/test_sprites/sprite3.png": { | ||
"x": 100, | ||
@@ -18,0 +18,0 @@ "y": 0, |
{ | ||
"G:\\spritesmith\\src-test\\test_sprites\\sprite1.png": { | ||
"/home/todd/github/spritesmith/src-test/test_sprites/sprite1.png": { | ||
"x": 0, | ||
@@ -8,3 +8,3 @@ "y": 0, | ||
}, | ||
"G:\\spritesmith\\src-test\\test_sprites\\sprite2.jpg": { | ||
"/home/todd/github/spritesmith/src-test/test_sprites/sprite2.jpg": { | ||
"x": 0, | ||
@@ -15,3 +15,3 @@ "y": 50, | ||
}, | ||
"G:\\spritesmith\\src-test\\test_sprites\\sprite3.png": { | ||
"/home/todd/github/spritesmith/src-test/test_sprites/sprite3.png": { | ||
"x": 0, | ||
@@ -18,0 +18,0 @@ "y": 100, |
@@ -50,3 +50,2 @@ // Load in modules and set up routes | ||
'renders a left-right spritesheet': 'assertSpritesheet', | ||
'has the proper coordinates': 'assertCoordinates', | ||
'An empty array': function () { | ||
@@ -62,24 +61,24 @@ this.namespace = 'empty.'; | ||
}, | ||
// 'A ridiculous amount of sprites': function () { | ||
// // Create and save an array of 500 sprites | ||
// var sprites = [], | ||
// spritePath = path.join(spriteDir, '16.jpg'), | ||
// i = 500; | ||
// while (i--) { sprites.push(spritePath); } | ||
// this.sprites = sprites; | ||
// this.namespace = 'ridiculous.'; | ||
// }, | ||
// 'does not crash': function () { | ||
// // Would have thrown | ||
// }, | ||
// 'returns an image': function () { | ||
// // DEV: Write out to actual_files | ||
// // if (true) { | ||
// if (false) { | ||
// try { fs.mkdirSync(__dirname + '/actual_files'); } catch (e) {} | ||
// fs.writeFileSync(__dirname + '/actual_files/' + this.namespace + 'sprite.png', this.result.image, 'binary'); | ||
// } | ||
'phantomjssmith': ['An array of sprites', function () { | ||
this.namespace = 'phantomjs.'; | ||
this.options = {'engine': 'phantomjs'}; | ||
}], | ||
'gmsmith': ['An array of sprites', function () { | ||
this.namespace = 'gm.'; | ||
this.options = {'engine': 'gm'}; | ||
}], | ||
'canvassmith': ['An array of sprites', function () { | ||
this.namespace = 'canvas.'; | ||
this.options = {'engine': 'canvas'}; | ||
}], | ||
'returns an image': function () { | ||
// DEV: Write out to actual_files | ||
// if (true) { | ||
if (false) { | ||
try { fs.mkdirSync(__dirname + '/actual_files'); } catch (e) {} | ||
fs.writeFileSync(__dirname + '/actual_files/' + this.namespace + 'sprite.png', this.result.image, 'binary'); | ||
} | ||
// assert.notEqual(this.result.image, ''); | ||
// }, | ||
assert.notEqual(this.result.image, ''); | ||
}, | ||
assertSpritesheet: function () { | ||
@@ -90,4 +89,4 @@ var result = this.result, | ||
// DEV: Write out to actual_files | ||
if (true) { | ||
// if (false) { | ||
// if (true) { | ||
if (false) { | ||
try { fs.mkdirSync(__dirname + '/actual_files'); } catch (e) {} | ||
@@ -94,0 +93,0 @@ fs.writeFileSync(__dirname + '/actual_files/' + namespace + 'sprite.png', result.image, 'binary'); |
@@ -1,2 +0,3 @@ | ||
module.exports = [{ | ||
// Generate basic outlines | ||
var outlines = [{ | ||
"An array of sprites": { | ||
@@ -19,11 +20,28 @@ "when processed via spritesmith": { | ||
} | ||
// Relocated to specific engines | ||
// }, { | ||
// // DEV: This only tests the used engine -- this was specific to `gm` + file descriptors | ||
// "A ridiculous amount of sprites": { | ||
// "when processed via spritesmith": { | ||
// "does not crash": true, | ||
// "returns an image": true | ||
// } | ||
// } | ||
}]; | ||
}]; | ||
function addEngineTest(engine) { | ||
// Attempt to load the engine | ||
try { | ||
require(engine); | ||
} catch (e) {} | ||
// Create an engine-specific test | ||
var outline = {}; | ||
outline[engine] = { | ||
'when processed via spritesmith': { | ||
'returns an image': true | ||
} | ||
}; | ||
// Add it to our list | ||
outlines.push(outline); | ||
} | ||
// Test specific engines | ||
addEngineTest('phantomjssmith'); | ||
addEngineTest('gmsmith'); | ||
addEngineTest('canvassmith'); | ||
// Export the outlines | ||
module.exports = outlines; |
@@ -148,3 +148,4 @@ var async = require('async'), | ||
var canvasEngine, | ||
gmEngine; | ||
gmEngine, | ||
phantomjsEngine; | ||
try { | ||
@@ -159,3 +160,3 @@ canvasEngine = require('canvassmith'); | ||
try { | ||
phatomjsEngine = require('phantomjssmith'); | ||
phantomjsEngine = require('phantomjssmith'); | ||
} catch (e) {} | ||
@@ -165,5 +166,5 @@ | ||
if (gmEngine) { addEngine('gm', gmEngine); } | ||
if (phatomjsEngine) { addEngine('phantomjs', phatomjsEngine); } | ||
if (phantomjsEngine) { addEngine('phantomjs', phantomjsEngine); } | ||
// Export Spritesmith | ||
module.exports = Spritesmith; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
1476282
480
3