Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tests; cmd line args

  • Loading branch information...
commit 8c2b42b49d4a7374eb70feacc2403e26823d0133 1 parent fc5e533
@aheckmann authored
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
4 Makefile
@@ -1,5 +1,9 @@
+
test:
@node test/ $(TESTS)
+test-all:
+ @node test/ --integration $(TESTS)
+
.PHONY: test
View
2  test/70.js
@@ -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  test/78.js
@@ -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
36 test/append.js
@@ -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
24 test/arc.js
@@ -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
3  test/autoOrient.js
@@ -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
3  test/autoOrientAll.js
@@ -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
20 test/background.js
@@ -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
24 test/bezier.js
@@ -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
18 test/bitdepth.js
@@ -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
18 test/blur.js
@@ -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
4 test/changeFormat.js
@@ -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
18 test/charcoal.js
@@ -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
18 test/chop.js
@@ -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
26 test/circle.js
@@ -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
16 test/colorize.js
@@ -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
18 test/colors.js
@@ -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);
});
View
18 test/comment.js
@@ -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
- .comment("%m:%f %wx%h")
+ var m = gm
+ .comment("%m:%f %wx%h");
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-comment', args[2]);
+ assert.equal('"%m:%f %wx%h"', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/comment.png', function comment (err) {
finish(err);
});
View
18 test/contrast.js
@@ -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
- .contrast(2)
+ var m = gm
+ .contrast(2);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('+contrast', args[2]);
+ assert.equal('+contrast', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/contrast.png', function contrast (err) {
finish(err);
});
View
18 test/crop.js
@@ -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
- .crop(200, 155, 300, 0)
+ var m = gm
+ .crop(200, 155, 300, 0);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-crop', args[2]);
+ assert.equal('200x155+300+0', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/crop.png', function crop (err) {
finish(err);
});
View
18 test/cycle.js
@@ -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
- .cycle(4)
+ var m = gm
+ .cycle(4);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-cycle', args[2]);
+ assert.equal(4, args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/cycle.png', function cycle (err) {
finish(err);
});
View
17 test/despeckle.js
@@ -1,10 +1,19 @@
-// 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
- .despeckle()
+ var m = gm
+ .despeckle();
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-despeckle', args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/despeckle.png', function despeckle (err) {
finish(err);
});
View
18 test/dither.js
@@ -1,13 +1,19 @@
-// 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) {
+ if (gm._options.imageMagick)
+ return finish();
- var g = gm.monochrome()
+ var g = gm.monochrome().dither();
- if (!g._options.imageMagick) {
- g.dither()
- }
+ var args = g.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-monochrome', args[2]);
+ assert.equal('-dither', args[3]);
+
+ if (!GM.integration)
+ return finish();
g.write(dir + '/dither.png', function dither (err) {
finish(err);
View
17 test/edge.js
@@ -1,10 +1,19 @@
-// 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
- .edge(2)
+ var m = gm
+ .edge(2);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-edge', args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/edge.png', function edge (err) {
finish(err);
});
View
24 test/ellipse.js
@@ -1,12 +1,28 @@
-// 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("blue", 1)
- .drawEllipse(155, 80, 130, 50)
+ .drawEllipse(155, 80, 130, 50);
+
+ 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('blue', args[7]);
+ assert.equal('-draw', args[8]);
+ assert.equal('ellipse 155,80 130,50 0,360', args[9]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/ellipse.png', function ellipse (err) {
finish(err);
});
View
18 test/emboss.js
@@ -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
- .emboss(2)
+ var m = gm
+ .emboss(2);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-emboss', args[2]);
+ assert.equal(2, args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/emboss.png', function emboss (err) {
finish(err);
});
View
17 test/enhance.js
@@ -1,10 +1,19 @@
-// 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
- .enhance()
+ var m = gm
+ .enhance();
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-enhance', args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/enhance.png', function enhance (err) {
finish(err);
});
View
17 test/equalize.js
@@ -1,10 +1,19 @@
-// 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
- .equalize()
+ var m = gm
+ .equalize();
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-equalize', args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/equalize.png', function equalize (err) {
finish(err);
});
View
20 test/extent.js
@@ -1,8 +1,24 @@
-module.exports = function (gm, dir, finish) {
+var assert = require('assert')
- gm
+module.exports = function (gm, dir, finish, GM) {
+
+ var m = gm
.scale(200, 100)
.extent(300,300)
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-size', args[1]);
+ assert.equal('300x300', args[2]);
+ assert.equal('-scale', args[4]);
+ assert.equal('200x100', args[5]);
+ assert.equal('-extent', args[6]);
+ assert.equal('300x300', args[7]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/extent.png', function resize (err) {
finish(err);
});
View
13 test/flatten.js
@@ -4,8 +4,17 @@ module.exports = function (img, dir, finish, gm) {
var changed = gm('whatever.png').gravity("Souths")
assert.equal(changed._out[1], 'NorthWest');
- gm(dir + '/layers.psd')
- .flatten()
+ var m = gm(dir + '/layers.psd')
+ .flatten();
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-flatten', args[2]);
+
+ if (!gm.integration)
+ return finish();
+
+ m
.write(dir + '/unlayered.jpg', function (err) {
finish(err);
});
View
17 test/flip.js
@@ -1,10 +1,19 @@
-// 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
- .flip()
+ var m = gm
+ .flip();
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-flip', args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/flip.png', function flip (err) {
finish(err);
});
View
17 test/flop.js
@@ -1,10 +1,19 @@
-// 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
- .flop()
+ var m = gm
+ .flop();
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-flop', args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/flop.png', function flop (err) {
finish(err);
});
View
17 test/fromBuffer.js
@@ -8,8 +8,21 @@ module.exports = function (_, dir, finish, gm) {
var buf = fs.readFileSync(original);
- gm(buf)
- .rotate('red', 30)
+ var m = gm(buf)
+ .rotate('red', 30);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-', args[1]);
+ assert.equal('-background', args[2]);
+ assert.equal('red', args[3]);
+ assert.equal('-rotate', args[4]);
+ assert.equal(30, args[5]);
+
+ if (!gm.integration)
+ return finish();
+
+ m
.write(result, function crop (err) {
if (err) return finish(err);
View
18 test/gamma.js
@@ -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
- .gamma(1.7, 2.3, 1.3)
+ var m = gm
+ .gamma(1.7, 2.3, 1.3);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-gamma', args[2]);
+ assert.equal('1.7,2.3,1.3', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/gamma.png', function gamma (err) {
finish(err);
});
View
4 test/getterColor.js
@@ -1,9 +1,9 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-
var assert = require('assert')
module.exports = function (_, dir, finish, gm) {
+ if (!gm.integration)
+ return finish();
gm(dir + '/blue.gif').color(function (err, color) {
if (err) return finish(err);
View
6 test/getterDepth.js
@@ -1,9 +1,9 @@
-// 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) {
+ if (!GM.integration)
+ return finish();
gm
.depth(function getterdepth (err, depth) {
View
6 test/getterFilesize.js
@@ -1,9 +1,9 @@
-// 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) {
+ if (!GM.integration)
+ return finish();
gm
.filesize(function getterfilesize (err, size) {
View
7 test/getterFormat.js
@@ -1,9 +1,10 @@
-// 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) {
+ if (!GM.integration)
+ return finish();
+
gm
.format(function getterformat (err, format) {
if (err) return finish(err);
View
5 test/getterIdentify.js
@@ -1,9 +1,10 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-
var assert = require('assert')
module.exports = function (_, dir, finish, gm) {
+ if (!gm.integration)
+ return finish();
+
var im = _._options.imageMagick;
var test = gm(dir + '/photo.JPG');
View
6 test/getterRes.js
@@ -1,9 +1,9 @@
-// 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) {
+ if (!GM.integration)
+ return finish();
gm
.res(function getterres (err, res) {
View
4 test/getterSize.js
@@ -1,9 +1,9 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-
var assert = require('assert');
module.exports = function (gm, dir, finish, GM) {
+ if (!GM.integration)
+ return finish();
gm
.size(function gettersize (err, size) {
View
21 test/gh-17.js
@@ -1,11 +1,22 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+var assert =require('assert')
-module.exports = function (gm, dir, finish) {
-
- gm
+module.exports = function (gm, dir, finish, GM) {
+ var m = gm
.crop(200, 155, 300, 0)
- .resize(58, 50, '%')
+ .resize(58, 50, '%');
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-crop', args[2]);
+ assert.equal('200x155+300+0', args[3]);
+ assert.equal('-resize', args[4]);
+ assert.equal('58x50%', args[5]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/cropresize.png', function crop (err) {
finish(err);
});
View
7 test/gifFrame.js
@@ -1,10 +1,11 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-
var fs = require('fs');
+var assert =require('assert')
module.exports = function (_, dir, finish, gm) {
-
+ if (!gm.integration)
+ return finish();
+
gm(dir + '/original.gif[0]')
.write(dir + '/gifFrame.jpg', function gifFrame (err){
finish(err);
View
15 test/gifFrameStream.js
@@ -1,11 +1,18 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-
+var assert = require('assert')
var fs = require('fs');
module.exports = function (_, dir, finish, gm) {
-
- gm(fs.createReadStream(dir + '/original.gif'), "original.gif[0]")
+ var m = gm(fs.createReadStream(dir + '/original.gif'), "original.gif[0]")
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-[0]', args[1]);
+
+ if (!gm.integration)
+ return finish();
+
+ m
.write(dir + '/gifFrameStream.jpg', function gifFrame (err){
finish(err);
});
View
23 test/gravity.js
@@ -4,10 +4,29 @@ module.exports = function (img, dir, finish, gm) {
var changed = gm('whatever.png').gravity("Souths")
assert.equal(changed._out[1], 'NorthWest');
- img
+ var m = img
.scale(200, 100)
.gravity("South")
- .extent(300,300)
+ .extent(300,300);
+
+ var args = m.args();
+ assert.deepEqual(args, [
+ 'convert',
+ '-size',
+ '300x300',
+ '/Users/aaronheckmann/test/gm/gm/test/../examples/imgs/original.jpg',
+ '-scale',
+ '200x100',
+ '-gravity',
+ 'South',
+ '-extent',
+ '300x300',
+ '-' ])
+
+ if (!gm.integration)
+ return finish();
+
+ m
.write(dir + '/gravity.png', function resize (err) {
finish(err);
});
View
17 test/implode.js
@@ -1,10 +1,19 @@
-// 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
- .implode(0.8)
+ var m = gm
+ .implode(0.8);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-implode', args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/implode.png', function implode (err) {
finish(err);
});
View
9 test/index.js
@@ -8,6 +8,8 @@ var gleak = require('gleak')();
var fs = require('fs');
var only = process.argv.slice(2);
+gm.integration = !! ~process.argv.indexOf('--integration');
+if (gm.integration) only.shift();
var files = fs.readdirSync(__dirname).filter(filter);
var pending, total = pending = files.length * 2;
@@ -23,7 +25,8 @@ function filter (file) {
}
function test (imagemagick) {
- if (imagemagick) return gm(dir + '/original.jpg').options({ imageMagick: true });
+ if (imagemagick)
+ return gm(dir + '/original.jpg').options({ imageMagick: true });
return gm(dir + '/original.jpg');
}
@@ -50,6 +53,10 @@ process.stdout.write('\033[?25l');
files.forEach(function (file) {
var filename = __dirname + '/' + file;
+
+ // gm tests
require(filename)(test(), dir, finish(filename), gm);
+
+ // imagemagick tests
require(filename)(test(true), dir, finish(filename), gm);
});
View
17 test/interlace.js
@@ -1,10 +1,19 @@
-// 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
- .interlace()
+ var m = gm
+ .interlace();
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-interlace', args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/edge.png', function edge (err) {
finish(err);
});
View
16 test/label.js
@@ -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
.label("%m:%f %wx%h")
+
+ var args= m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-label', args[2]);
+ assert.equal('"%m:%f %wx%h"', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/label.png', function label (err) {
finish(err);
});
View
20 test/limit.js
@@ -1,11 +1,25 @@
-// 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
.limit("memory", "32MB")
.limit("map", "64MB")
+
+ var args = m.args()
+ assert.equal('convert', args[0]);
+ assert.equal('-limit', args[2]);
+ assert.equal('memory', args[3]);
+ assert.equal('32MB', args[4]);
+ assert.equal('-limit', args[5]);
+ assert.equal('map', args[6]);
+ assert.equal('64MB', args[7]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/limit.png', function limit (err) {
finish(err);
});
View
23 test/line.js
@@ -1,12 +1,27 @@
-// 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)
- .drawLine(20, 10, 50, 40)
+ .drawLine(20, 10, 50, 40);
+
+ var args = m.args();
+ 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('-draw', args[8]);
+ assert.equal('line 20,10 50,40', args[9]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/line.png', function line (err) {
finish(err);
});
View
18 test/lower.js
@@ -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
- .lower(10, 14)
+ var m = gm
+ .lower(10, 14);
+
+ var args= m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('+raise', args[2]);
+ assert.equal('10x14', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/lower.png', function lower (err) {
finish(err);
});
View
18 test/median.js
@@ -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
- .median(4)
+ var m = gm
+ .median(4);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-median', args[2]);
+ assert.equal(4, args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/median.png', function media (err) {
finish(err);
});
View
12 test/minifiy.js
@@ -1,12 +0,0 @@
-
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-
-module.exports = function (gm, dir, finish) {
- if (gm._options.imageMagick) return finish();
-
- gm
- .minify()
- .write(dir + '/minify.png', function minify (err) {
- finish(err);
- });
-}
View
21 test/minify.js
@@ -0,0 +1,21 @@
+
+var assert = require('assert')
+
+module.exports = function (gm, dir, finish, GM) {
+ if (gm._options.imageMagick) return finish();
+
+ var m = gm
+ .minify();
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-minify', args[1]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
+ .write(dir + '/minify.png', function minify (err) {
+ finish(err);
+ });
+}
View
18 test/modulate.js
@@ -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
- .modulate(120, 100, 80)
+ var m = gm
+ .modulate(120, 100, 80);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-modulate', args[2]);
+ assert.equal('120,100,80', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/modulate.png', function modulate (err) {
finish(err);
});
View
17 test/monochrome.js
@@ -1,10 +1,19 @@
-// 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
- .monochrome()
+ var m = gm
+ .monochrome();
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-monochrome', args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/monochrome.png', function monochrome (err) {
finish(err);
});
View
9 test/morph.js
@@ -1,10 +1,15 @@
-// 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) {
if (gm._options.imageMagick) return finish();
+ if (!GM.integration)
+ return finish();
+
+ // todo, improve this api to allow multiple images
+
gm
.morph(dir + '/morpher.jpg', dir + '/morphed.jpg', function morph (err) {
finish(err);
View
20 test/negative.js
@@ -1,10 +1,22 @@
-// 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
- .negative()
+ var m = GM('temp.jpg').negative(true);
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('+negate', args[2]);
+
+ m = gm.negative();
+ args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-negate', args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/negative.png', function negative (err) {
finish(err);
});
View
34 test/new.js
@@ -1,15 +1,43 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+var assert = require('assert')
module.exports = function (_, dir, finish, gm) {
- gm(525, 110, "#00ff55aa")
+ var m = gm(525, 110, "#00ff55aa")
.fontSize(68)
.stroke("#efe", 2)
.fill("#555")
.drawText(20, 72, "graphics")
.fill("#fa0")
- .drawText(274, 72, " magick")
+ .drawText(274, 72, " magick");
+
+ var args = m.args();
+ assert.deepEqual(args, [
+ 'convert',
+ '-size',
+ '525x110',
+ 'xc:#00ff55aa',
+ '-pointsize',
+ 68,
+ '-strokewidth',
+ 2,
+ '-stroke',
+ '#efe',
+ '-fill',
+ '#555',
+ '-draw',
+ 'text 20,72 "graphics"',
+ '-fill',
+ '#fa0',
+ '-draw',
+ 'text 274,72 "magick"',
+ '-'
+ ])
+
+ if (!gm.integration)
+ return finish();
+
+ m
.write(dir + '/new.png', function New (err){
finish(err);
});
View
18 test/noise1.js
@@ -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
- .noise(0.3)
+ var m = gm
+ .noise(0.3);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-noise', args[2]);
+ assert.equal(0.3, args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/noise1.png', function noise1 (err) {
finish(err);
});
View
18 test/noise2.js
@@ -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
- .noise('laplacian')
+ var m = gm
+ .noise('laplacian');
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('+noise', args[2]);
+ assert.equal('laplacian', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/noise2.png', function noise2 (err) {
finish(err);
});
View
6 test/options.js
@@ -1,7 +1,4 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-
-
var assert = require('assert')
, fs = require('fs')
@@ -26,6 +23,9 @@ module.exports = function (_, dir, finish, gm) {
var writeFile = dir + '/IM-negative' + Math.random() + '.png';
var imageMagick = gm.subClass({ imageMagick: true });
+ if (!gm.integration)
+ return finish();
+
imageMagick(dir + '/photo.JPG')
.negative()
.write(writeFile, function (err, _1, _2, cmd) {
View
18 test/paint.js
@@ -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
- .paint(2)
+ var m = gm
+ .paint(2);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-paint', args[2]);
+ assert.equal(2, args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/paint.png', function paint (err) {
finish(err);
});
View
30 test/polygon.js
@@ -1,13 +1,35 @@
-// 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")
- .drawPolygon([60, 10], [183, 73], [185, 13], [167, 35], [165, 17], [163, 19])
+ .drawPolygon([60, 10], [183, 73], [185, 13], [167, 35], [165, 17], [163, 19]);
+
+ var args = m.args();
+ assert.deepEqual(args, [
+ 'convert',
+ '/Users/aaronheckmann/test/gm/gm/test/../examples/imgs/original.jpg',
+ '-blur',
+ '8x4',
+ '-strokewidth',
+ 3,
+ '-stroke',
+ 'red',
+ '-fill',
+ '#ffffffbb',
+ '-draw',
+ 'polygon 60,10,183,73,185,13,167,35,165,17,163,19',
+ '-'
+ ])
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/polygon.png', function polygon (err) {
finish(err);
});
View
30 test/polyline.js
@@ -1,13 +1,35 @@
-// 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")
- .drawPolyline([40, 10], [143, 153], [185, 53], [147, 15], [145, 17], [43, 19])
+ .drawPolyline([40, 10], [143, 153], [185, 53], [147, 15], [145, 17], [43, 19]);
+
+ var args = m.args();
+ assert.deepEqual(args, [
+ 'convert',
+ '/Users/aaronheckmann/test/gm/gm/test/../examples/imgs/original.jpg',
+ '-blur',
+ '8x4',
+ '-strokewidth',
+ 3,
+ '-stroke',
+ 'red',
+ '-fill',
+ '#ffffffbb',
+ '-draw',
+ 'polyline 40,10,143,153,185,53,147,15,145,17,43,19',
+ '-'
+ ])
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/polyline.png', function polyline (err) {
finish(err);
});
View
18 test/quality.js
@@ -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
- .quality(5)
+ var m = gm
+ .quality(5);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-quality', args[1]);
+ assert.equal(5, args[2]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/quality.png', function quality (err) {
finish(err);
});
View
18 test/raise.js
@@ -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
- .raise(10,14)
+ var m = gm
+ .raise(10,14);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-raise', args[2]);
+ assert.equal('10x14', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/raise.png', function raise (err) {
finish(err);
});
View
32 test/rectangle.js
@@ -1,14 +1,38 @@
-// 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")
.drawRectangle(40, 10, 251, 120)
- .drawRectangle(160, 10, 270, 220, 3)
+ .drawRectangle(160, 10, 270, 220, 3);
+
+ var args = m.args();
+ assert.deepEqual(args, [
+ 'convert',
+ '/Users/aaronheckmann/test/gm/gm/test/../examples/imgs/original.jpg',
+ '-blur',
+ '8x4',
+ '-strokewidth',
+ 3,
+ '-stroke',
+ 'red',
+ '-fill',
+ '#ffffffbb',
+ '-draw',
+ 'rectangle 40,10 251,120 ',
+ '-draw',
+ 'roundRectangle 160,10 270,220 3,3',
+ '-'
+ ])
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/rectangle.png', function rectangle (err) {
finish(err);
});
View
18 test/region.js
@@ -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
- .region(130, 170, 307, 00)
+ var m = gm
+ .region(130, 170, 307, 00);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-region', args[2]);
+ assert.equal('130x170+307+0', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/region.png', function region (err) {
finish(err);
});
View
18 test/resample.js
@@ -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
- .resample(420, 120)
+ var m = gm
+ .resample(420, 120);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-resample', args[2]);
+ assert.equal('420x120', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/resample.png', function resample (err) {
finish(err);
});
View
20 test/resize.js
@@ -1,10 +1,22 @@
-// 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
- .resize(58, 50, '%')
+ var m = gm
+ .resize(58, 50, '%');
+
+ var args= m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-size', args[1]); // TODO remove this from resize() method
+ assert.equal('58x50%', args[2]);
+ assert.equal('-resize', args[4]);
+ assert.equal('58x50%', args[5]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/resize.png', function resize (err) {
finish(err);
});
View
18 test/roll.js
@@ -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
- .roll(40,-100)
+ var m = gm
+ .roll(40,-100);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-roll', args[2]);
+ assert.equal('+40-100', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/roll.png', function roll (err) {
finish(err);
});
View
22 test/rotate.js
@@ -1,16 +1,26 @@
-// 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) {
+
+ var m = gm
+ .rotate('red', -40);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-background', args[2]);
+ assert.equal('red', args[3]);
+ assert.equal('-rotate', args[4]);
+ assert.equal(-40, args[5]);
+
+ if (!GM.integration)
+ return finish();
- gm
- .rotate('red', -40)
+ m
.write(dir + '/rotate.png', function rotate (err, _0, _1, cmd) {
assert.ok(/"-rotate" "-40"/.test(cmd));
- gm
+ m
.rotate('red', 0)
.write(dir + '/rotate.png', function rotate (err, _0, _1, cmd) {
assert.ok(!/"-rotate" "-40"/.test(cmd));
View
18 test/scale.js
@@ -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
- .scale(100, 100)
+ var m = gm
+ .scale(100, 100);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-scale', args[2]);
+ assert.equal('100x100', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/scale.png', function scale (err) {
finish(err);
});
View
20 test/sepia.js
@@ -1,10 +1,22 @@
-// 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
- .sepia()
+ var m = gm
+ .sepia();
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-modulate', args[2]);
+ assert.equal('115,0,100', args[3]);
+ assert.equal('-colorize', args[4]);
+ assert.equal('7,21,50', args[5]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/sepia.png', function sepia (err) {
finish(err);
});
View
15 test/setFormat.js
@@ -1,10 +1,17 @@
-// 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
- .setFormat('png')
+ var m = gm
+ .setFormat('png');
+
+ assert.equal('png', m._outputFormat);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/setformat', function setformat (err) {
finish(err);
});
View
18 test/sharpen.js
@@ -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
- .sharpen(19, 10)
+ var m = gm
+ .sharpen(19, 10);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-sharpen', args[2]);
+ assert.equal('19x10', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/sharpen.png', function sharpen (err) {
finish(err);
});
View
18 test/solarize.js
@@ -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
- .solarize(68.5)
+ var m = gm
+ .solarize(68.5);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-solarize', args[2]);
+ assert.equal('68.5%', args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/solarize.png', function solarize (err) {
finish(err);
});
View
18 test/spread.js
@@ -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
- .spread(12)
+ var m = gm
+ .spread(12);
+
+ var args = m.args();
+ assert.equal('convert', args[0]);
+ assert.equal('-spread', args[2]);
+ assert.equal(12, args[3]);
+
+ if (!GM.integration)
+ return finish();
+
+ m
.write(dir + '/spread.png', function spread (err) {
finish(err);
});
View
14 test/streamIn.js
@@ -1,11 +1,19 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-
+var assert = require('assert')
var fs = require('fs');
module.exports = function (_, dir, finish, gm) {
- gm(fs.createReadStream(dir + '/original.jpg'), "original.jpg")
+ var stream = fs.createReadStream(dir + '/original.jpg');
+ var m = gm(stream, "original.jpg");
+
+ assert.equal(stream, m.sourceStream);
+ assert.equal('original.jpg', m.source);
+
+ if (!gm.integration)
+ return finish();
+
+ m
.write(dir + '/streamIn.png', function streamIn (err) {
finish(err);
});
View
5 test/streamInGetter.js
@@ -1,9 +1,10 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-
+var assert = require('assert')
var fs = require('fs');
module.exports = function (_, dir, finish, gm) {
+ if (!gm.integration)
+ return finish();
gm(fs.createReadStream(dir + '/original.jpg'), "original.jpg")
.size({bufferStream: true}, function (err, size) {
View
5 test/streamInOut.js
@@ -1,10 +1,11 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-
var fs = require('fs');
module.exports = function (_, dir, finish, gm) {
+ if (!gm.integration)
+ return finish();
+
gm(fs.createReadStream(dir + '/original.jpg'), "original.jpg")
.stream(function streamOut (err, stdout, stderr) {
if (err) return finish(err);
View
7 test/streamOut.js
@@ -1,9 +1,10 @@
-// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
-
var fs = require('fs');
-module.exports = function (gm, dir, finish) {
+module.exports = function (gm, dir, finish, GM) {