Permalink
Browse files

new tests

  • Loading branch information...
1 parent daed1f1 commit 152d1b14a8d5fc7e21cf911d558362a302aaaa54 @aheckmann committed May 17, 2011
Showing with 73 additions and 0 deletions.
  1. +5 −0 Makefile
  2. +14 −0 test/bezier.js
  3. +26 −0 test/index.js
  4. +14 −0 test/polygon.js
  5. +14 −0 test/polyline.js
View
@@ -0,0 +1,5 @@
+
+test:
+ @node test/
+
+.PHONY: test
View
@@ -0,0 +1,14 @@
+
+// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+
+module.exports = function (gm, dir, finish) {
+
+ gm
+ .blur(8, 4)
+ .stroke("red", 3)
+ .fill("#ffffffbb")
+ .drawBezier([0, 10], [183, 163], [183, 10], [0, 10])
+ .write(dir + '/bezier.png', function bezier (err) {
+ finish(err);
+ });
+}
View
@@ -0,0 +1,26 @@
+
+// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+
+var dir = __dirname + '/../examples/imgs';
+var gm = require('../')
+
+function test () {
+ return gm(dir + '/original.png');
+}
+
+var fs = require('fs');
+
+fs.readdirSync(__dirname).forEach(function (file) {
+ if (!/\.js$/.test(file)) return;
+ if ('index.js' === file) return;
+
+ var filename = __dirname + '/' + file;
+
+ if (!fs.statSync(filename).isFile()) return;
+
+ require(filename)(test(), dir, finish);
+});
+
+function finish (err) {
+ if (err) throw new Error(err);
+}
View
@@ -0,0 +1,14 @@
+
+// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+
+module.exports = function (gm, dir, finish) {
+
+ gm
+ .blur(8, 4)
+ .stroke("red", 3)
+ .fill("#ffffffbb")
+ .drawPolygon([60, 10], [183, 73], [185, 13], [167, 35], [165, 17], [163, 19])
+ .write(dir + '/polygon.png', function polygon (err) {
+ finish(err);
+ });
+}
View
@@ -0,0 +1,14 @@
+
+// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
+
+module.exports = function (gm, dir, finish) {
+
+ gm
+ .blur(8, 4)
+ .stroke("red", 3)
+ .fill("#ffffffbb")
+ .drawPolyline([40, 10], [143, 153], [185, 53], [147, 15], [145, 17], [43, 19])
+ .write(dir + '/polyline.png', function polyline (err) {
+ finish(err);
+ });
+}

0 comments on commit 152d1b1

Please sign in to comment.