Skip to content

Commit

Permalink
tests; report when no matching tests found
Browse files Browse the repository at this point in the history
  • Loading branch information
aheckmann committed Sep 21, 2022
1 parent e4f2ff7 commit ad6097f
Show file tree
Hide file tree
Showing 85 changed files with 418 additions and 381 deletions.
9 changes: 4 additions & 5 deletions test/densityGm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const assert = require('assert')
const path = require('path');

module.exports = function (gm, dir, finish, GM) {
const isImageMagickTest = !!gm._options.imageMagick;

var NUMBER = 100;
var NUMBER2 = 200;

Expand All @@ -12,11 +14,8 @@ module.exports = function (gm, dir, finish, GM) {
assert.equal('-density', gArgs[1]);
assert.equal(NUMBER + 'x' + NUMBER2, gArgs[2]);

if (gm._options.imageMagick)
return finish();

if (!GM.integration)
return finish();
if (isImageMagickTest) return finish();
if (!GM.integration) return finish();

const destPath = path.join(dir, 'density.png');
g.write(destPath, function density (err) {
Expand Down
20 changes: 7 additions & 13 deletions test/densityIm.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@

var assert = require('assert');
const assert = require('assert')
const path = require('path');

module.exports = function (gm, dir, finish, GM) {
'use strict';
const isImageMagickTest = !!gm._options.imageMagick;

// a magic number
var NUMBER = 100;

// image magic version
var im = gm.options({imageMagick: true}).density(NUMBER);

var imArgs = im.args();

assert.equal('convert', imArgs[0]);
assert.equal('-density', imArgs[1]);
assert.equal(NUMBER, imArgs[2]);

if (gm._options.imageMagick)
return finish();

if (!GM.integration)
return finish();
if (isImageMagickTest) return finish();
if (!GM.integration) return finish();

im.write(dir + '/density.png', function density (err) {
const destPath = path.join(dir, 'density.png');
im.write(destPath, function density (err) {
finish(err);
});
};
12 changes: 5 additions & 7 deletions test/despeckle.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@

var assert = require('assert')
const assert = require('assert')
const path = require('path');

module.exports = function (gm, dir, finish, GM) {

var m = gm
.despeckle();
var m = gm.despeckle();

var args = m.args();
assert.equal('convert', args[0]);
Expand All @@ -13,8 +11,8 @@ module.exports = function (gm, dir, finish, GM) {
if (!GM.integration)
return finish();

m
.write(dir + '/despeckle.png', function despeckle (err) {
const destPath = path.join(dir, 'despeckle.png');
m.write(destPath, function despeckle (err) {
finish(err);
});
}
14 changes: 9 additions & 5 deletions test/dispose.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var assert = require('assert');
const assert = require('assert')
const path = require('path');

module.exports = function (img, dir, finish, gm) {
var EventEmitter = require('events').EventEmitter;
Expand All @@ -24,8 +25,11 @@ module.exports = function (img, dir, finish, gm) {
return finish();
}

gm(dir + '/photo.JPG').options({ disposers: [ disposer ]})
.thumb(1000, 1000, dir + '/dispose.png', function (err) {
const photoPath = path.join(dir, 'photo.JPG');
const disposePath = path.join(dir, 'dispose.png');

gm(photoPath).options({ disposers: [ disposer ]})
.thumb(1000, 1000, disposePath, function (err) {
assert.ok(err, "Expecting a disposed error");
});

Expand All @@ -34,8 +38,8 @@ module.exports = function (img, dir, finish, gm) {
noDispose();

function noDispose() {
gm(dir + '/photo.JPG').options({ disposers: [ disposer ]})
.thumb(1000, 1000, dir + '/dispose.png', function (err) {
gm(photoPath).options({ disposers: [ disposer ]})
.thumb(1000, 1000, disposePath, function (err) {
finish(err);
});
emitter.emit('disposeOK');
Expand Down
7 changes: 4 additions & 3 deletions test/dither.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var assert = require('assert')
const assert = require('assert')
const path = require('path');

module.exports = function (gm, dir, finish, GM) {
if (gm._options.imageMagick)
Expand All @@ -15,7 +15,8 @@ module.exports = function (gm, dir, finish, GM) {
if (!GM.integration)
return finish();

g.write(dir + '/dither.png', function dither (err) {
const destPath = path.join(dir, 'dither.png');
g.write(destPath, function dither (err) {
finish(err);
});
}
8 changes: 4 additions & 4 deletions test/edge.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var assert = require('assert')
const assert = require('assert')
const path = require('path');

module.exports = function (gm, dir, finish, GM) {

Expand All @@ -13,8 +13,8 @@ module.exports = function (gm, dir, finish, GM) {
if (!GM.integration)
return finish();

m
.write(dir + '/edge.png', function edge (err) {
const destPath = path.join(dir, 'edge.png');
m.write(destPath, function edge (err) {
finish(err);
});
}
8 changes: 4 additions & 4 deletions test/ellipse.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var assert = require('assert')
const assert = require('assert')
const path = require('path');

module.exports = function (gm, dir, finish, GM) {

Expand All @@ -22,8 +22,8 @@ module.exports = function (gm, dir, finish, GM) {
if (!GM.integration)
return finish();

m
.write(dir + '/ellipse.png', function ellipse (err) {
const destPath = path.join(dir, 'ellipse.png');
m.write(destPath, function ellipse (err) {
finish(err);
});
}
8 changes: 4 additions & 4 deletions test/emboss.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var assert = require('assert')
const assert = require('assert')
const path = require('path');

module.exports = function (gm, dir, finish, GM) {

Expand All @@ -14,8 +14,8 @@ module.exports = function (gm, dir, finish, GM) {
if (!GM.integration)
return finish();

m
.write(dir + '/emboss.png', function emboss (err) {
const destPath = path.join(dir, 'emboss.png');
m.write(destPath, function emboss (err) {
finish(err);
});
}
8 changes: 4 additions & 4 deletions test/enhance.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var assert = require('assert')
const assert = require('assert')
const path = require('path');

module.exports = function (gm, dir, finish, GM) {

Expand All @@ -13,8 +13,8 @@ module.exports = function (gm, dir, finish, GM) {
if (!GM.integration)
return finish();

m
.write(dir + '/enhance.png', function enhance (err) {
const destPath = path.join(dir, 'enhance.png');
m.write(destPath, function enhance (err) {
finish(err);
});
}
8 changes: 4 additions & 4 deletions test/equalize.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var assert = require('assert')
const assert = require('assert')
const path = require('path');

module.exports = function (gm, dir, finish, GM) {

Expand All @@ -13,8 +13,8 @@ module.exports = function (gm, dir, finish, GM) {
if (!GM.integration)
return finish();

m
.write(dir + '/equalize.png', function equalize (err) {
const destPath = path.join(dir, 'equalize.png');
m.write(destPath, function equalize (err) {
finish(err);
});
}
7 changes: 4 additions & 3 deletions test/extent.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var assert = require('assert')
const assert = require('assert')
const path = require('path');

module.exports = function (gm, dir, finish, GM) {

Expand All @@ -16,8 +17,8 @@ module.exports = function (gm, dir, finish, GM) {
if (!GM.integration)
return finish();

m
.write(dir + '/extent.png', function resize (err) {
const destPath = path.join(dir, 'extent.png');
m.write(destPath, function resize (err) {
finish(err);
});
}
10 changes: 6 additions & 4 deletions test/flatten.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var assert = require('assert')
const assert = require('assert');
const path = require('path');

module.exports = function (img, dir, finish, gm) {
// graphicsmagick considers PSD broken
Expand All @@ -7,7 +8,8 @@ module.exports = function (img, dir, finish, gm) {
return finish();
}

var m = gm(dir + '/layers.psd')
const layersPath = path.join(dir, 'layers.psd');
var m = gm(layersPath)
.options({ imageMagick: true })
.flatten();

Expand All @@ -18,8 +20,8 @@ module.exports = function (img, dir, finish, gm) {
if (!gm.integration)
return finish();

m
.write(dir + '/unlayered.jpg', function (err) {
const destPath = path.join(dir, 'unlayered.jpg');
m.write(destPath, function (err) {
finish(err);
});
}
8 changes: 4 additions & 4 deletions test/flip.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var assert = require('assert')
const assert = require('assert');
const path = require('path');

module.exports = function (gm, dir, finish, GM) {

Expand All @@ -13,8 +13,8 @@ module.exports = function (gm, dir, finish, GM) {
if (!GM.integration)
return finish();

m
.write(dir + '/flip.png', function flip (err) {
const destPath = path.join(dir, 'flip.png');
m.write(destPath, function flip (err) {
finish(err);
});
}
8 changes: 4 additions & 4 deletions test/flop.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var assert =require('assert')
const assert = require('assert');
const path = require('path');

module.exports = function (gm, dir, finish, GM) {

Expand All @@ -13,8 +13,8 @@ module.exports = function (gm, dir, finish, GM) {
if (!GM.integration)
return finish();

m
.write(dir + '/flop.png', function flop (err) {
const destPath = path.join(dir, 'flop.png');
m.write(destPath, function flop (err) {
finish(err);
});
}
9 changes: 5 additions & 4 deletions test/fromBuffer.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
var assert = require('assert')
var fs = require('fs')
const assert = require('assert');
const path = require('path');
const fs = require('fs')

module.exports = function (_, dir, finish, gm) {

var original = dir + '/original.jpg';
var result = dir + '/fromBuffer.png';
const original = path.join(dir, 'original.jpg');
const result = path.join(dir, 'fromBuffer.png');

var buf = fs.readFileSync(original);

Expand Down
8 changes: 4 additions & 4 deletions test/gamma.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var assert =require('assert')
const assert = require('assert');
const path = require('path');

module.exports = function (gm, dir, finish, GM) {

Expand All @@ -14,8 +14,8 @@ module.exports = function (gm, dir, finish, GM) {
if (!GM.integration)
return finish();

m
.write(dir + '/gamma.png', function gamma (err) {
const destPath = path.join(dir, 'gamma.png');
m.write(destPath, function gamma (err) {
finish(err);
});
}
7 changes: 4 additions & 3 deletions test/getterColor.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

var assert = require('assert')
const assert = require('assert');
const path = require('path');

module.exports = function (_, dir, finish, gm) {
if (!gm.integration)
return finish();

gm(dir + '/blue.gif').color(function (err, color) {
const destPath = path.join(dir, 'blue.gif');
gm(destPath).color(function (err, color) {
if (err) return finish(err);

assert.equal(1, color)
Expand Down
7 changes: 4 additions & 3 deletions test/getterFormatGIF.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

var assert = require('assert');
const assert = require('assert');
const path = require('path');

module.exports = function (_, dir, finish, gm) {
if (!gm.integration)
return finish();

gm(dir + '/original.gif')
const destPath = path.join(dir, 'original.gif');
gm(destPath)
.format(function (err, type) {
if (err) return finish(err);

Expand Down
Loading

0 comments on commit ad6097f

Please sign in to comment.