test crop image
This commit is contained in:
@@ -4,7 +4,22 @@ QUnit.test('should load image', function( assert ) {
|
|||||||
var done = assert.async();
|
var done = assert.async();
|
||||||
var editor = new ImageEditor('canvas');
|
var editor = new ImageEditor('canvas');
|
||||||
editor.loadImage('fixtures/dog.jpg', function() {
|
editor.loadImage('fixtures/dog.jpg', function() {
|
||||||
assert.ok(editor.canvas.getImage());
|
assert.ok(editor.canvas.getImage(), 'image loaded');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
QUnit.test('should crop image', function( assert ) {
|
||||||
|
var done = assert.async();
|
||||||
|
var editor = new ImageEditor('canvas');
|
||||||
|
editor.loadImage('fixtures/dog.jpg', function() {
|
||||||
|
editor.crop(400, 100, 'cm');
|
||||||
|
var data = editor.canvas.getViewport().getData();
|
||||||
|
assert.equal(data.dim.width, 400, 'sets crop width');
|
||||||
|
assert.equal(data.dim.height, 100, 'sets crop height');
|
||||||
|
assert.equal(data.dim.units, 'cm', 'set units');
|
||||||
|
assert.equal(data.width, 1049, 'sets image width');
|
||||||
|
assert.equal(data.height, 262.25, 'sets image height');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user