From 31f06ad2edcdf465e02b688381c6515760e1a13d Mon Sep 17 00:00:00 2001 From: Martin Date: Sat, 5 Aug 2017 13:17:14 +0200 Subject: [PATCH] use imageData in the crop test --- test/unit/image-editor.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/unit/image-editor.js b/test/unit/image-editor.js index 45c3f70..57c5db0 100644 --- a/test/unit/image-editor.js +++ b/test/unit/image-editor.js @@ -13,13 +13,12 @@ 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'); + editor.crop(400, 200, 'cm'); + var data = editor.canvas.getImageData().getData(); + assert.strictEqual(data.width, 400, 'sets image width'); + assert.strictEqual(data.height, 200, 'sets image height'); + assert.strictEqual(data.x, 0, 'sets crop x'); + assert.equal(data.y, 0.12482117310443483, 'sets crop y'); done(); }); }); \ No newline at end of file