Permalink
Browse files

tests; cmd line args

  • Loading branch information...
1 parent fc5e533 commit 8c2b42b49d4a7374eb70feacc2403e26823d0133 @aheckmann committed Dec 14, 2012
Showing with 1,158 additions and 308 deletions.
  1. +4 −0 Makefile
  2. +2 −0 test/70.js
  3. +2 −0 test/78.js
  4. +32 −4 test/append.js
  5. +21 −3 test/arc.js
  6. +3 −0 test/autoOrient.js
  7. +3 −0 test/autoOrientAll.js
  8. +18 −2 test/background.js
  9. +21 −3 test/bezier.js
  10. +14 −4 test/bitdepth.js
  11. +14 −4 test/blur.js
  12. +3 −1 test/changeFormat.js
  13. +14 −4 test/charcoal.js
  14. +14 −4 test/chop.js
  15. +22 −4 test/circle.js
  16. +13 −3 test/colorize.js
  17. +14 −4 test/colors.js
  18. +14 −4 test/comment.js
  19. +14 −4 test/contrast.js
  20. +14 −4 test/crop.js
  21. +14 −4 test/cycle.js
  22. +13 −4 test/despeckle.js
  23. +12 −6 test/dither.js
  24. +13 −4 test/edge.js
  25. +20 −4 test/ellipse.js
  26. +14 −4 test/emboss.js
  27. +13 −4 test/enhance.js
  28. +13 −4 test/equalize.js
  29. +18 −2 test/extent.js
  30. +11 −2 test/flatten.js
  31. +13 −4 test/flip.js
  32. +13 −4 test/flop.js
  33. +15 −2 test/fromBuffer.js
  34. +14 −4 test/gamma.js
  35. +2 −2 test/getterColor.js
  36. +3 −3 test/getterDepth.js
  37. +3 −3 test/getterFilesize.js
  38. +4 −3 test/getterFormat.js
  39. +3 −2 test/getterIdentify.js
  40. +3 −3 test/getterRes.js
  41. +2 −2 test/getterSize.js
  42. +16 −5 test/gh-17.js
  43. +4 −3 test/gifFrame.js
  44. +11 −4 test/gifFrameStream.js
  45. +21 −2 test/gravity.js
  46. +13 −4 test/implode.js
  47. +8 −1 test/index.js
  48. +13 −4 test/interlace.js
  49. +13 −3 test/label.js
  50. +17 −3 test/limit.js
  51. +19 −4 test/line.js
  52. +14 −4 test/lower.js
  53. +14 −4 test/median.js
  54. +0 −12 test/minifiy.js
  55. +21 −0 test/minify.js
  56. +14 −4 test/modulate.js
  57. +13 −4 test/monochrome.js
  58. +7 −2 test/morph.js
  59. +16 −4 test/negative.js
  60. +31 −3 test/new.js
  61. +14 −4 test/noise1.js
  62. +14 −4 test/noise2.js
  63. +3 −3 test/options.js
  64. +14 −4 test/paint.js
  65. +26 −4 test/polygon.js
  66. +26 −4 test/polyline.js
  67. +14 −4 test/quality.js
  68. +14 −4 test/raise.js
  69. +28 −4 test/rectangle.js
  70. +14 −4 test/region.js
  71. +14 −4 test/resample.js
  72. +16 −4 test/resize.js
  73. +14 −4 test/roll.js
  74. +16 −6 test/rotate.js
  75. +14 −4 test/scale.js
  76. +16 −4 test/sepia.js
  77. +11 −4 test/setFormat.js
  78. +14 −4 test/sharpen.js
  79. +14 −4 test/solarize.js
  80. +14 −4 test/spread.js
  81. +11 −3 test/streamIn.js
  82. +3 −2 test/streamInGetter.js
  83. +3 −2 test/streamInOut.js
  84. +4 −3 test/streamOut.js
  85. +12 −3 test/streamOutFormat.js
  86. +13 −4 test/strip.js
  87. +3 −3 test/subclass.js
  88. +14 −4 test/swirl.js
  89. +28 −4 test/text.js
  90. +5 −2 test/thumb.js
  91. +15 −3 test/thumbnail.js
  92. +0 −2 test/utils.js
View
@@ -1,5 +1,9 @@
+
test:
@node test/ $(TESTS)
+test-all:
+ @node test/ --integration $(TESTS)
+
.PHONY: test
View
@@ -7,6 +7,8 @@ var loading = __dirname + '/fixtures/loading.gif'
var favicon = __dirname + '/fixtures/favicon.png'
module.exports = function (_, dir, finish, gm) {
+ if (!gm.integration) return finish();
+
var pending = times/2;
var res = {};
View
@@ -2,6 +2,8 @@
var assert = require('assert')
module.exports = function (_, dir, next, gm) {
+ if (!gm.integration) return next();
+
var magick = _._options.imageMagick;
var name = magick ? '78-IM' : '78';
var out = dir + '/' + name;
View
@@ -8,11 +8,26 @@ module.exports = function (_, dir, next, gm) {
require('fs').unlinkSync(out);
} catch (_) {}
- gm(dir + '/lost.png')
+ var m = gm(dir + '/lost.png')
.append(dir + '/original.jpg', dir + '/original.jpg')
.append()
.background('#222')
- .write(out, function (err) {
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('/Users/aaronheckmann/test/gm/gm/test/../examples/imgs/lost.png',args[1]);
+ assert.equal('/Users/aaronheckmann/test/gm/gm/test/../examples/imgs/original.jpg',args[2]);
+ assert.equal('/Users/aaronheckmann/test/gm/gm/test/../examples/imgs/original.jpg',args[3]);
+ assert.equal('-background',args[4]);
+ assert.equal('#222',args[5]);
+ assert.equal('-append',args[6]);
+ assert.equal('-',args[7]);
+
+ if (!gm.integration) {
+ return horizontal(dir, next, gm);
+ }
+
+ m.write(out, function (err) {
if (err) return next(err);
gm(out).size(function (err, size) {
if (err) return next(err);
@@ -26,8 +41,21 @@ module.exports = function (_, dir, next, gm) {
function horizontal (dir, next, gm) {
- gm(dir + '/original.jpg')
- .append(dir + '/lost.png', true)
+ var m = gm(dir + '/original.jpg')
+ .append(dir + '/lost.png', true);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('/Users/aaronheckmann/test/gm/gm/test/../examples/imgs/original.jpg',args[1]);
+ assert.equal('/Users/aaronheckmann/test/gm/gm/test/../examples/imgs/lost.png',args[2]);
+ assert.equal('+append',args[3]);
+ assert.equal('-',args[4]);
+
+ if (!gm.integration) {
+ return next();
+ }
+
+ m
.write(out, function (err) {
if (err) return next(err);
gm(out).size(function (err, size) {
View
@@ -1,13 +1,31 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+var assert = require('assert')
-module.exports = function (gm, dir, finish) {
+module.exports = function (gm, dir, finish, GM) {
- gm
+ var m = gm
.blur(8, 4)
.stroke("red", 3)
.fill("#ffffffbb")
.drawArc(80, 10, 90, 20, 0, 180)
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-blur', args[2]);
+ assert.equal('8x4', args[3]);
+ assert.equal('-strokewidth', args[4]);
+ assert.equal(3, args[5]);
+ assert.equal('-stroke', args[6]);
+ assert.equal('red', args[7]);
+ assert.equal('-fill', args[8]);
+ assert.equal('#ffffffbb', args[9]);
+ assert.equal('-draw', args[10]);
+ assert.equal('arc 80,10 90,20 0,180', args[11]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/arc.png', function arc (err) {
finish(err);
});
View
@@ -4,6 +4,9 @@
var assert = require('assert')
module.exports = function (_, dir, finish, gm) {
+ if (!gm.integration)
+ return finish();
+
var filename = dir + '/autoOrient.jpg';
gm(dir + '/originalSideways.jpg').orientation(function (err, o) {
View
@@ -5,6 +5,9 @@ var assert = require('assert'),
fs = require('fs');
module.exports = function (_, dir, finish, gm) {
+ if (!gm.integration)
+ return finish();
+
var filename = dir + '/autoOrient.jpg';
var beforeValues = {
View
@@ -1,9 +1,25 @@
-module.exports = function (gm, dir, finish) {
+var assert =require('assert')
- gm
+module.exports = function (gm, dir, finish, GM) {
+
+ var m = gm
.crop(140,100)
.background("#FF0000")
.extent(340,300)
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-crop', args[2]);
+ assert.equal('140x100+0+0', args[3]);
+ assert.equal('-background', args[4]);
+ assert.equal('#FF0000', args[5]);
+ assert.equal('-extent', args[6]);
+ assert.equal('340x300', args[7]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/background.jpg', function (err) {
finish(err);
});
View
@@ -1,13 +1,31 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+var assert = require('assert')
-module.exports = function (gm, dir, finish) {
+module.exports = function (gm, dir, finish, GM) {
- gm
+ var m = gm
.blur(8, 4)
.stroke("red", 3)
.fill("#ffffffbb")
.drawBezier([0, 10], [183, 163], [183, 10], [0, 10])
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-blur', args[2]);
+ assert.equal('8x4', args[3]);
+ assert.equal('-strokewidth', args[4]);
+ assert.equal(3, args[5]);
+ assert.equal('-stroke', args[6]);
+ assert.equal('red', args[7]);
+ assert.equal('-fill', args[8]);
+ assert.equal('#ffffffbb', args[9]);
+ assert.equal('-draw', args[10]);
+ assert.equal('bezier 0,10,183,163,183,10,0,10', args[11]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/bezier.png', function bezier (err) {
finish(err);
});
View
@@ -1,10 +1,20 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+var assert = require('assert')
-module.exports = function (gm, dir, finish) {
+module.exports = function (gm, dir, finish, GM) {
- gm
- .bitdepth(2)
+ var m = gm
+ .bitdepth(2);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-depth', args[2]);
+ assert.equal(2, args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/bitdepth.png', function bitdepth (err) {
finish(err);
});
View
@@ -1,10 +1,20 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+var assert = require('assert')
-module.exports = function (gm, dir, finish) {
+module.exports = function (gm, dir, finish, GM) {
- gm
- .blur(18, 10)
+ var m = gm
+ .blur(18, 10);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-blur', args[2]);
+ assert.equal('18x10', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/blur.png', function blur (err) {
finish(err);
});
View
@@ -1,7 +1,9 @@
// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-module.exports = function (gm, dir, finish) {
+module.exports = function (gm, dir, finish, GM) {
+ if (!GM.integration)
+ return finish();
gm
.write(dir + '/changedformat.png', function changeformat (err) {
View
@@ -1,10 +1,20 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+var assert = require('assert')
-module.exports = function (gm, dir, finish) {
+module.exports = function (gm, dir, finish, GM) {
- gm
- .charcoal(1)
+ var m = gm
+ .charcoal(1);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-charcoal', args[2]);
+ assert.equal(1, args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/charcoal.png', function charcoal (err) {
finish(err);
});
View
@@ -1,10 +1,20 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+var assert = require('assert')
-module.exports = function (gm, dir, finish) {
+module.exports = function (gm, dir, finish, GM) {
- gm
- .chop(54, 1, 307, 1)
+ var m = gm
+ .chop(54, 1, 307, 1);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-chop', args[1]);
+ assert.equal('54x1+307+1', args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/chop.png', function chop (err) {
finish(err);
});
View
@@ -1,13 +1,31 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+var assert = require('assert')
-module.exports = function (gm, dir, finish) {
+module.exports = function (gm, dir, finish, GM) {
- gm
+ var m = gm
.blur(8, 4)
.stroke("red", 1)
.fill("#ffffffbb")
- .drawCircle(125, 45, 120, 5)
+ .drawCircle(125, 45, 120, 5);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-blur', args[2]);
+ assert.equal('8x4', args[3]);
+ assert.equal('-strokewidth', args[4]);
+ assert.equal(1, args[5]);
+ assert.equal('-stroke', args[6]);
+ assert.equal('red', args[7]);
+ assert.equal('-fill', args[8]);
+ assert.equal('#ffffffbb', args[9]);
+ assert.equal('-draw', args[10]);
+ assert.equal('circle 125,45 120,5', args[11]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/circle.png', function circle (err) {
finish(err);
});
View
@@ -1,10 +1,20 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+var assert = require('assert')
-module.exports = function (gm, dir, finish) {
+module.exports = function (gm, dir, finish, GM) {
- gm
+ var m = gm
.colorize(80, 0, 30)
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-colorize', args[2]);
+ assert.equal('80,0,30', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/colorize.png', function colorize (err) {
finish(err);
});
View
@@ -1,10 +1,20 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+var assert = require('assert')
-module.exports = function (gm, dir, finish) {
+module.exports = function (gm, dir, finish, GM) {
- gm
- .colors(16)
+ var m = gm
+ .colors(16);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-colors', args[2]);
+ assert.equal(16, args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/colors.png', function colors (err) {
finish(err);
});
Oops, something went wrong.

0 comments on commit 8c2b42b

Please sign in to comment.