mirror of https://gitgud.io/fatchan/gm
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.3 KiB
57 lines
1.3 KiB
|
|
var assert = require('assert')
|
|
|
|
module.exports = function (gm, dir, finish, GM) {
|
|
|
|
var a = GM('img.png').resize(10);
|
|
var args = a.args();
|
|
assert.equal('convert', args[0]);
|
|
assert.equal('-resize', args[2]);
|
|
if (a._options.imageMagick) {
|
|
assert.equal('10', args[3]);
|
|
} else {
|
|
assert.equal('10x', args[3]);
|
|
}
|
|
|
|
var a = GM('img.png').resize(10, 20);
|
|
var args = a.args();
|
|
assert.equal('convert', args[0]);
|
|
assert.equal('-resize', args[2]);
|
|
assert.equal('10x20', args[3]);
|
|
|
|
var a = GM('img.png').resize(10, false, '%');
|
|
var args = a.args();
|
|
assert.equal('convert', args[0]);
|
|
assert.equal('-resize', args[2]);
|
|
if (a._options.imageMagick) {
|
|
assert.equal('10%', args[3]);
|
|
} else {
|
|
assert.equal('10x%', args[3]);
|
|
}
|
|
|
|
var a = GM('img.png').resize('10%');
|
|
var args = a.args();
|
|
assert.equal('convert', args[0]);
|
|
assert.equal('-resize', args[2]);
|
|
if (a._options.imageMagick) {
|
|
assert.equal('10%', args[3]);
|
|
} else {
|
|
assert.equal('10%x', args[3]);
|
|
}
|
|
|
|
var m = gm
|
|
.resize(58, 50, '%');
|
|
|
|
var args= m.args();
|
|
assert.equal('convert', args[0]);
|
|
assert.equal('-resize', args[2]);
|
|
assert.equal('58x50%', args[3]);
|
|
|
|
if (!GM.integration)
|
|
return finish();
|
|
|
|
m
|
|
.write(dir + '/resize.png', function resize (err) {
|
|
finish(err);
|
|
});
|
|
}
|
|
|