diff --git a/.travis.yml b/.travis.yml index ba9461d5..955e18f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ node_js: - "0.12" - "0.11" - "0.10" -script: 'npm run build && npm run test && npm run lint && npm run lint_tests' before_install: - sudo apt-get update -qq - sudo apt-get install -qq libgif-dev libpng-dev libjpeg8-dev libpango1.0-dev libcairo2-dev +script: 'npm run build && npm run test && npm run lint && npm run lint_tests' diff --git a/package.json b/package.json index ae49b5ae..aceab54a 100644 --- a/package.json +++ b/package.json @@ -47,8 +47,8 @@ "uglify-js": "2.4.x", "jscs": "2.1.x", "jshint": "2.8.x", - "qunit": "0.7.2", - "istanbul": "0.3.x" + "qunit": "0.7.x", + "istanbul": "0.4.x" }, "engines": { "node": ">=0.4.0" diff --git a/src/static_canvas.class.js b/src/static_canvas.class.js index 93deba40..7eaa8797 100644 --- a/src/static_canvas.class.js +++ b/src/static_canvas.class.js @@ -887,7 +887,6 @@ } this.fire('after:render'); - canvasToDrawOn.restore(); return this; }, diff --git a/test.js b/test.js index 0b081ec5..e4f04d10 100644 --- a/test.js +++ b/test.js @@ -5,6 +5,7 @@ testrunner.options.log.tests = false; testrunner.options.log.assertions = false; testrunner.options.coverage = true; +testrunner.options.maxBlockDuration = 120000; testrunner.run({ deps: "./test/fixtures/test_script.js", diff --git a/test/unit/group.js b/test/unit/group.js index 5c10cab0..de5a5353 100644 --- a/test/unit/group.js +++ b/test/unit/group.js @@ -3,7 +3,7 @@ var el = fabric.document.createElement('canvas'); el.width = 600; el.height = 600; - var canvas = this.canvas = fabric.isLikelyNode ? fabric.createCanvasForNode() : new fabric.Canvas(el); + var canvas = this.canvas = fabric.isLikelyNode ? fabric.createCanvasForNode(600, 600, {enableRetinaScaling: false}) : new fabric.Canvas(el); // function _createImageElement() { // return fabric.isLikelyNode ? new (require('canvas').Image)() : fabric.document.createElement('img'); @@ -515,19 +515,25 @@ test('toObject without default values', function() { }); test('test group transformMatrix', function() { - var rect1 = new fabric.Rect({ top: 5, left: 5, width: 5, height: 5, strokeWidth: 0, fill: 'black', opacity: 1}), - rect2 = new fabric.Rect({ top: 15, left: 15, width: 5, height: 5, strokeWidth: 0, fill: 'black', opacity: 1}), - group = new fabric.Group([ rect1, rect2 ]), - ctx = canvas.contextContainer, isTransparent = fabric.util.isTransparent; + var rect1 = new fabric.Rect({ top: 1, left: 1, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1}), + rect2 = new fabric.Rect({ top: 4, left: 4, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1}), + group = new fabric.Group([ rect1, rect2 ], {opacity: 1, fill: 'blue', strokeWidth: 0}), + isTransparent = fabric.util.isTransparent, + ctx = canvas.contextContainer; canvas.add(group); + equal(canvas.enableRetinaScaling, false); + equal(isTransparent(ctx, 0, 0, 0), true); + equal(isTransparent(ctx, 1, 1, 0), false); + equal(isTransparent(ctx, 2, 2, 0), false); equal(isTransparent(ctx, 3, 3, 0), true); - equal(isTransparent(ctx, 8, 8, 0), false); - var imageData = ctx.getImageData(0, 0, (tolerance * 2) || 1, (tolerance * 2) || 1); - equal(imageData, [0]); - group.transformMatrix = [1.2, 0, 0, 1.2, 1, 1]; + equal(isTransparent(ctx, 4, 4, 0), false); + group.transformMatrix = [2, 0, 0, 2, 1, 1]; canvas.renderAll(); - equal(isTransparent(ctx, 101, 101, 0), true); - equal(isTransparent(ctx, 131, 131, 0), false); + equal(isTransparent(ctx, 0, 0, 0), true); + equal(isTransparent(ctx, 1, 1, 0), true); + equal(isTransparent(ctx, 2, 2, 0), true); + equal(isTransparent(ctx, 3, 3, 0), false); + equal(isTransparent(ctx, 4, 4, 0), false); }); // asyncTest('cloning group with image', function() { // var rect = new fabric.Rect({ top: 100, left: 100, width: 30, height: 10 }), diff --git a/test/unit/shadow.js b/test/unit/shadow.js index cd91d76c..4f7d4813 100644 --- a/test/unit/shadow.js +++ b/test/unit/shadow.js @@ -141,7 +141,7 @@ var object = shadow.toObject(), shadow2 = new fabric.Shadow(object), object2 = shadow2.toObject(); - equal(shadow.affectStroke, shadow2.affectStroke) + equal(shadow.affectStroke, shadow2.affectStroke); deepEqual(object, object2); }); diff --git a/test/unit/text.js b/test/unit/text.js index b21746db..d161b00c 100644 --- a/test/unit/text.js +++ b/test/unit/text.js @@ -271,7 +271,7 @@ // temp workaround for text objects not obtaining width under node text.width = 100; - text.textAlign = 'justify' + text.textAlign = 'justify'; equal(removeTranslate(text.toSVG()), removeTranslate(TEXT_SVG_JUSTIFIED)); });