From efb850c39ca300fe3ddd894d21e2de831a89ebba Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Thu, 31 Dec 2020 15:26:25 +0100 Subject: [PATCH 1/2] added back stroke uniform --- src/shapes/object.class.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shapes/object.class.js b/src/shapes/object.class.js index 638027fd538..4a1ed098559 100644 --- a/src/shapes/object.class.js +++ b/src/shapes/object.class.js @@ -839,7 +839,7 @@ strokeLineCap: this.strokeLineCap, strokeDashOffset: this.strokeDashOffset, strokeLineJoin: this.strokeLineJoin, - // strokeUniform: this.strokeUniform, + strokeUniform: this.strokeUniform, strokeMiterLimit: toFixed(this.strokeMiterLimit, NUM_FRACTION_DIGITS), scaleX: toFixed(this.scaleX, NUM_FRACTION_DIGITS), scaleY: toFixed(this.scaleY, NUM_FRACTION_DIGITS), From d027fd68472f77db1677a4ec8fff4c826c195d17 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Thu, 31 Dec 2020 16:16:49 +0100 Subject: [PATCH 2/2] fixed UTs --- test/unit/activeselection.js | 81 +++++++++++----------- test/unit/canvas.js | 19 +++--- test/unit/canvas_static.js | 9 +-- test/unit/circle.js | 67 ++++++++++--------- test/unit/ellipse.js | 65 +++++++++--------- test/unit/group.js | 63 +++++++++--------- test/unit/image.js | 3 +- test/unit/itext.js | 3 +- test/unit/line.js | 69 +++++++++---------- test/unit/object.js | 126 ++++++++++++++++++----------------- test/unit/object_clipPath.js | 5 +- test/unit/path.js | 63 +++++++++--------- test/unit/polygon.js | 99 +++++++++++++-------------- test/unit/polyline.js | 99 +++++++++++++-------------- test/unit/rect.js | 71 ++++++++++---------- test/unit/text.js | 87 ++++++++++++------------ test/unit/textbox.js | 1 + 17 files changed, 474 insertions(+), 456 deletions(-) diff --git a/test/unit/activeselection.js b/test/unit/activeselection.js index ea0b6b1c233..89b5fc75bb6 100644 --- a/test/unit/activeselection.js +++ b/test/unit/activeselection.js @@ -53,37 +53,38 @@ var clone = group.toObject(); var expectedObject = { - 'version': fabric.version, - 'type': 'activeSelection', - 'originX': 'left', - 'originY': 'top', - 'left': 50, - 'top': 100, - 'width': 80, - 'height': 60, - 'fill': 'rgb(0,0,0)', - 'stroke': null, - 'strokeWidth': 0, - 'strokeDashArray': null, - 'strokeLineCap': 'butt', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'miter', - 'strokeMiterLimit': 4, - 'scaleX': 1, - 'scaleY': 1, - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'angle': 0, - 'flipX': false, - 'flipY': false, - 'opacity': 1, - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', - 'skewX': 0, - 'skewY': 0, - 'objects': clone.objects + version: fabric.version, + type: 'activeSelection', + originX: 'left', + originY: 'top', + left: 50, + top: 100, + width: 80, + height: 60, + fill: 'rgb(0,0,0)', + stroke: null, + strokeWidth: 0, + strokeDashArray: null, + strokeLineCap: 'butt', + strokeDashOffset: 0, + strokeLineJoin: 'miter', + strokeMiterLimit: 4, + scaleX: 1, + scaleY: 1, + shadow: null, + visible: true, + backgroundColor: '', + angle: 0, + flipX: false, + flipY: false, + opacity: 1, + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + skewX: 0, + skewY: 0, + strokeUniform: false, + objects: clone.objects }; assert.deepEqual(clone, expectedObject); @@ -98,7 +99,7 @@ group.includeDefaultValues = false; var clone = group.toObject(); var objects = [{ - 'version': fabric.version, + version: fabric.version, type: 'rect', left: 10, top: -30, @@ -106,7 +107,7 @@ height: 10, strokeWidth: 0 }, { - 'version': fabric.version, + version: fabric.version, type: 'rect', left: -40, top: -10, @@ -115,13 +116,13 @@ strokeWidth: 0 }]; var expectedObject = { - 'version': fabric.version, - 'type': 'activeSelection', - 'left': 50, - 'top': 100, - 'width': 80, - 'height': 60, - 'objects': objects + version: fabric.version, + type: 'activeSelection', + left: 50, + top: 100, + width: 80, + height: 60, + objects: objects }; assert.deepEqual(clone, expectedObject); }); diff --git a/test/unit/canvas.js b/test/unit/canvas.js index 76a43f34ed9..d1fba56d96e 100644 --- a/test/unit/canvas.js +++ b/test/unit/canvas.js @@ -55,12 +55,12 @@ '13.99], ["z", null]]}'; var PATH_DATALESS_JSON = '{"version":"' + fabric.version + '","objects":[{"type":"path","version":"' + fabric.version + '","originX":"left","originY":"top","left":99.5,"top":99.5,"width":200,"height":200,"fill":"rgb(0,0,0)",' + - '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeMiterLimit":4,' + + '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":false,"strokeMiterLimit":4,' + '"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,' + '"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"fill","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"sourcePath":"http://example.com/"}]}'; var RECT_JSON = '{"version":"' + fabric.version + '","objects":[{"type":"rect","version":"' + fabric.version + '","originX":"left","originY":"top","left":0,"top":0,"width":10,"height":10,"fill":"rgb(0,0,0)",' + - '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,' + + '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":false,"strokeMiterLimit":4,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,' + '"shadow":null,' + '"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"fill","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0}],"background":"#ff5555","overlay":"rgba(0,0,0,0.2)"}'; @@ -174,12 +174,12 @@ }); QUnit.test('interactive', function(assert) { - assert.ok(typeof canvas.interactive == 'boolean'); + assert.ok(typeof canvas.interactive === 'boolean'); assert.ok(canvas.interactive, 'default is true'); }); QUnit.test('selection', function(assert) { - assert.ok(typeof canvas.selection == 'boolean'); + assert.ok(typeof canvas.selection === 'boolean'); assert.ok(canvas.selection, 'default is true'); }); @@ -784,7 +784,7 @@ var rect = makeRect({ left: 0, top: 0, width: 30, height: 30 }), rectOver = makeRect({ left: 0, top: 0, width: 30, height: 30 }), target, - pointer = { clientX: 15, clientY: 15, 'shiftKey': true }, + pointer = { clientX: 15, clientY: 15, shiftKey: true }, pointer2 = { clientX: 4, clientY: 4 }; canvas.add(rect); canvas.add(rectOver); @@ -1346,7 +1346,7 @@ QUnit.test('toObject', function(assert) { assert.ok(typeof canvas.toObject === 'function'); var expectedObject = { - 'version': fabric.version, + version: fabric.version, objects: canvas.getObjects() }; assert.deepEqual(expectedObject, canvas.toObject()); @@ -1362,7 +1362,7 @@ var clipPath = makeRect(); var canvasWithClipPath = new fabric.Canvas(null, { clipPath: clipPath }); var expectedObject = { - 'version': fabric.version, + version: fabric.version, objects: canvasWithClipPath.getObjects(), clipPath: { type: 'rect', @@ -1396,7 +1396,8 @@ skewX: 0, skewY: 0, rx: 0, - ry: 0 + ry: 0, + strokeUniform: false } }; @@ -1412,7 +1413,7 @@ QUnit.test('toDatalessObject', function(assert) { assert.ok(typeof canvas.toDatalessObject === 'function'); var expectedObject = { - 'version': fabric.version, + version: fabric.version, objects: canvas.getObjects() }; diff --git a/test/unit/canvas_static.js b/test/unit/canvas_static.js index 4fc0ff1ab59..619be566c7b 100644 --- a/test/unit/canvas_static.js +++ b/test/unit/canvas_static.js @@ -41,17 +41,17 @@ '13.99], ["z"]]}], "background": "#ff5555","overlay": "rgba(0,0,0,0.2)"}'; var PATH_DATALESS_JSON = '{"version":"' + fabric.version + '","objects":[{"type":"path","version":"' + fabric.version + '","originX":"left","originY":"top","left":99.5,"top":99.5,"width":200,"height":200,"fill":"rgb(0,0,0)",' + - '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeMiterLimit":4,' + + '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":false,"strokeMiterLimit":4,' + '"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,' + '"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"fill","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"sourcePath":"http://example.com/"}]}'; var RECT_JSON = '{"version":"' + fabric.version + '","objects":[{"type":"rect","version":"' + fabric.version + '","originX":"left","originY":"top","left":0,"top":0,"width":10,"height":10,"fill":"rgb(0,0,0)",' + - '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeMiterLimit":4,' + + '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":false,"strokeMiterLimit":4,' + '"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,' + '"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"fill","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0}],"background":"#ff5555","overlay":"rgba(0,0,0,0.2)"}'; var RECT_JSON_WITH_PADDING = '{"version":"' + fabric.version + '","objects":[{"type":"rect","version":"' + fabric.version + '","originX":"left","originY":"top","left":0,"top":0,"width":10,"height":20,"fill":"rgb(0,0,0)",' + - '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeMiterLimit":4,' + + '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":false,"strokeMiterLimit":4,' + '"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,' + '"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"fill","globalCompositeOperation":"source-over","skewX":0,"skewY":0,"rx":0,"ry":0,"padding":123,"foo":"bar"}]}'; @@ -106,7 +106,8 @@ skewX: 0, skewY: 0, cropX: 0, - cropY: 0 + cropY: 0, + strokeUniform: false }; function _createImageElement() { diff --git a/test/unit/circle.js b/test/unit/circle.js index 5f67219ff37..666fcc999e1 100644 --- a/test/unit/circle.js +++ b/test/unit/circle.js @@ -86,39 +86,40 @@ QUnit.test('toObject', function(assert) { var circle = new fabric.Circle(); var defaultProperties = { - 'version': fabric.version, - 'type': 'circle', - 'originX': 'left', - 'originY': 'top', - 'left': 0, - 'top': 0, - 'width': 0, - 'height': 0, - 'fill': 'rgb(0,0,0)', - 'stroke': null, - 'strokeWidth': 1, - 'strokeDashArray': null, - 'strokeLineCap': 'butt', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'miter', - 'strokeMiterLimit': 4, - 'scaleX': 1, - 'scaleY': 1, - 'angle': 0, - 'flipX': false, - 'flipY': false, - 'opacity': 1, - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', - 'radius': 0, - 'startAngle': 0, - 'endAngle': 2 * Math.PI, - 'skewX': 0, - 'skewY': 0, + version: fabric.version, + type: 'circle', + originX: 'left', + originY: 'top', + left: 0, + top: 0, + width: 0, + height: 0, + fill: 'rgb(0,0,0)', + stroke: null, + strokeWidth: 1, + strokeDashArray: null, + strokeLineCap: 'butt', + strokeDashOffset: 0, + strokeLineJoin: 'miter', + strokeMiterLimit: 4, + scaleX: 1, + scaleY: 1, + angle: 0, + flipX: false, + flipY: false, + opacity: 1, + shadow: null, + visible: true, + backgroundColor: '', + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + radius: 0, + startAngle: 0, + endAngle: 2 * Math.PI, + skewX: 0, + skewY: 0, + strokeUniform: false }; assert.ok(typeof circle.toObject === 'function'); assert.deepEqual(circle.toObject(), defaultProperties); diff --git a/test/unit/ellipse.js b/test/unit/ellipse.js index 59fe3544ca2..9624535e239 100644 --- a/test/unit/ellipse.js +++ b/test/unit/ellipse.js @@ -26,38 +26,39 @@ QUnit.test('toObject', function(assert) { var ellipse = new fabric.Ellipse(); var defaultProperties = { - 'version': fabric.version, - 'type': 'ellipse', - 'originX': 'left', - 'originY': 'top', - 'left': 0, - 'top': 0, - 'width': 0, - 'height': 0, - 'fill': 'rgb(0,0,0)', - 'stroke': null, - 'strokeWidth': 1, - 'strokeDashArray': null, - 'strokeLineCap': 'butt', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'miter', - 'strokeMiterLimit': 4, - 'scaleX': 1, - 'scaleY': 1, - 'angle': 0, - 'flipX': false, - 'flipY': false, - 'opacity': 1, - 'skewX': 0, - 'skewY': 0, - 'rx': 0, - 'ry': 0, - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', + version: fabric.version, + type: 'ellipse', + originX: 'left', + originY: 'top', + left: 0, + top: 0, + width: 0, + height: 0, + fill: 'rgb(0,0,0)', + stroke: null, + strokeWidth: 1, + strokeDashArray: null, + strokeLineCap: 'butt', + strokeDashOffset: 0, + strokeLineJoin: 'miter', + strokeMiterLimit: 4, + scaleX: 1, + scaleY: 1, + angle: 0, + flipX: false, + flipY: false, + opacity: 1, + skewX: 0, + skewY: 0, + rx: 0, + ry: 0, + shadow: null, + visible: true, + backgroundColor: '', + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + strokeUniform: false, }; assert.ok(typeof ellipse.toObject === 'function'); assert.deepEqual(ellipse.toObject(), defaultProperties); diff --git a/test/unit/group.js b/test/unit/group.js index f07120190fa..b93ad5c49cc 100644 --- a/test/unit/group.js +++ b/test/unit/group.js @@ -152,37 +152,38 @@ var clone = group.toObject(); var expectedObject = { - 'version': fabric.version, - 'type': 'group', - 'originX': 'left', - 'originY': 'top', - 'left': 50, - 'top': 100, - 'width': 80, - 'height': 60, - 'fill': 'rgb(0,0,0)', - 'stroke': null, - 'strokeWidth': 0, - 'strokeDashArray': null, - 'strokeLineCap': 'butt', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'miter', - 'strokeMiterLimit': 4, - 'scaleX': 1, - 'scaleY': 1, - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'angle': 0, - 'flipX': false, - 'flipY': false, - 'opacity': 1, - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', - 'skewX': 0, - 'skewY': 0, - 'objects': clone.objects + version: fabric.version, + type: 'group', + originX: 'left', + originY: 'top', + left: 50, + top: 100, + width: 80, + height: 60, + fill: 'rgb(0,0,0)', + stroke: null, + strokeWidth: 0, + strokeDashArray: null, + strokeLineCap: 'butt', + strokeDashOffset: 0, + strokeLineJoin: 'miter', + strokeMiterLimit: 4, + scaleX: 1, + scaleY: 1, + shadow: null, + visible: true, + backgroundColor: '', + angle: 0, + flipX: false, + flipY: false, + opacity: 1, + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + skewX: 0, + skewY: 0, + objects: clone.objects, + strokeUniform: false }; assert.deepEqual(clone, expectedObject); diff --git a/test/unit/image.js b/test/unit/image.js index 662dc939d9e..9aebc858950 100644 --- a/test/unit/image.js +++ b/test/unit/image.js @@ -66,7 +66,8 @@ skewY: 0, crossOrigin: null, cropX: 0, - cropY: 0 + cropY: 0, + strokeUniform: false }; function _createImageElement() { diff --git a/test/unit/itext.js b/test/unit/itext.js index 1b8424f3475..022f300f8a1 100644 --- a/test/unit/itext.js +++ b/test/unit/itext.js @@ -44,7 +44,8 @@ skewX: 0, skewY: 0, charSpacing: 0, - styles: { } + styles: { }, + strokeUniform: false, }; diff --git a/test/unit/line.js b/test/unit/line.js index 17906b10a35..b3377403090 100644 --- a/test/unit/line.js +++ b/test/unit/line.js @@ -1,40 +1,41 @@ (function(){ var LINE_OBJECT = { - 'version': fabric.version, - 'type': 'line', - 'originX': 'left', - 'originY': 'top', - 'left': 11, - 'top': 12, - 'width': 2, - 'height': 2, - 'fill': 'rgb(0,0,0)', - 'stroke': null, - 'strokeWidth': 1, - 'strokeDashArray': null, - 'strokeLineCap': 'butt', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'miter', - 'strokeMiterLimit': 4, - 'scaleX': 1, - 'scaleY': 1, - 'angle': 0, - 'flipX': false, - 'flipY': false, - 'opacity': 1, - 'x1': -1, - 'y1': -1, - 'x2': 1, - 'y2': 1, - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', - 'skewX': 0, - 'skewY': 0, + version: fabric.version, + type: 'line', + originX: 'left', + originY: 'top', + left: 11, + top: 12, + width: 2, + height: 2, + fill: 'rgb(0,0,0)', + stroke: null, + strokeWidth: 1, + strokeDashArray: null, + strokeLineCap: 'butt', + strokeDashOffset: 0, + strokeLineJoin: 'miter', + strokeMiterLimit: 4, + scaleX: 1, + scaleY: 1, + angle: 0, + flipX: false, + flipY: false, + opacity: 1, + x1: -1, + y1: -1, + x2: 1, + y2: 1, + shadow: null, + visible: true, + backgroundColor: '', + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + skewX: 0, + skewY: 0, + strokeUniform: false }; QUnit.module('fabric.Line'); diff --git a/test/unit/object.js b/test/unit/object.js index 4d5c09b3934..0c8c93292da 100644 --- a/test/unit/object.js +++ b/test/unit/object.js @@ -106,13 +106,13 @@ QUnit.test('toJSON', function(assert) { var emptyObjectJSON = '{"type":"object","version":"' + fabric.version + '","originX":"left","originY":"top","left":0,"top":0,"width":0,"height":0,"fill":"rgb(0,0,0)",' + - '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeMiterLimit":4,' + + '"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeDashOffset":0,"strokeLineJoin":"miter","strokeUniform":false,"strokeMiterLimit":4,' + '"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,' + '"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"fill","globalCompositeOperation":"source-over",' + '"skewX":0,"skewY":0}'; var augmentedJSON = '{"type":"object","version":"' + fabric.version + '","originX":"left","originY":"top","left":0,"top":0,"width":122,"height":0,"fill":"rgb(0,0,0)",' + - '"stroke":null,"strokeWidth":1,"strokeDashArray":[5,2],"strokeLineCap":"round","strokeDashOffset":0,"strokeLineJoin":"bevel","strokeMiterLimit":5,' + + '"stroke":null,"strokeWidth":1,"strokeDashArray":[5,2],"strokeLineCap":"round","strokeDashOffset":0,"strokeLineJoin":"bevel","strokeUniform":false,"strokeMiterLimit":5,' + '"scaleX":1.3,"scaleY":1,"angle":0,"flipX":false,"flipY":true,"opacity":0.88,' + '"shadow":null,"visible":true,"backgroundColor":"","fillRule":"nonzero","paintFirst":"fill","globalCompositeOperation":"source-over",' + '"skewX":0,"skewY":0}'; @@ -135,69 +135,71 @@ QUnit.test('toObject', function(assert) { var emptyObjectRepr = { - 'version': fabric.version, - 'type': 'object', - 'originX': 'left', - 'originY': 'top', - 'left': 0, - 'top': 0, - 'width': 0, - 'height': 0, - 'fill': 'rgb(0,0,0)', - 'stroke': null, - 'strokeWidth': 1, - 'strokeDashArray': null, - 'strokeLineCap': 'butt', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'miter', - 'strokeMiterLimit': 4, - 'scaleX': 1, - 'scaleY': 1, - 'angle': 0, - 'flipX': false, - 'flipY': false, - 'opacity': 1, - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', - 'skewX': 0, - 'skewY': 0, + version: fabric.version, + type: 'object', + originX: 'left', + originY: 'top', + left: 0, + top: 0, + width: 0, + height: 0, + fill: 'rgb(0,0,0)', + stroke: null, + strokeWidth: 1, + strokeDashArray: null, + strokeLineCap: 'butt', + strokeDashOffset: 0, + strokeLineJoin: 'miter', + strokeMiterLimit: 4, + scaleX: 1, + scaleY: 1, + angle: 0, + flipX: false, + flipY: false, + opacity: 1, + shadow: null, + visible: true, + backgroundColor: '', + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + skewX: 0, + skewY: 0, + strokeUniform: false }; var augmentedObjectRepr = { - 'version': fabric.version, - 'type': 'object', - 'originX': 'left', - 'originY': 'top', - 'left': 10, - 'top': 20, - 'width': 30, - 'height': 40, - 'fill': 'rgb(0,0,0)', - 'stroke': null, - 'strokeWidth': 1, - 'strokeDashArray': [5, 2], - 'strokeLineCap': 'round', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'bevel', - 'strokeMiterLimit': 5, - 'scaleX': 1, - 'scaleY': 1, - 'angle': 0, - 'flipX': true, - 'flipY': false, - 'opacity': 0.13, - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', - 'skewX': 0, - 'skewY': 0 + version: fabric.version, + type: 'object', + originX: 'left', + originY: 'top', + left: 10, + top: 20, + width: 30, + height: 40, + fill: 'rgb(0,0,0)', + stroke: null, + strokeWidth: 1, + strokeDashArray: [5, 2], + strokeLineCap: 'round', + strokeDashOffset: 0, + strokeLineJoin: 'bevel', + strokeMiterLimit: 5, + scaleX: 1, + scaleY: 1, + angle: 0, + flipX: true, + flipY: false, + opacity: 0.13, + shadow: null, + visible: true, + backgroundColor: '', + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + skewX: 0, + skewY: 0, + strokeUniform: false }; var cObj = new fabric.Object(); diff --git a/test/unit/object_clipPath.js b/test/unit/object_clipPath.js index 91fd47d63a5..fe8ab29d1e2 100644 --- a/test/unit/object_clipPath.js +++ b/test/unit/object_clipPath.js @@ -44,8 +44,9 @@ fillRule: 'nonzero', paintFirst: 'fill', globalCompositeOperation: 'source-over', - skewX: 0, - skewY: 0, + skewX: 0, + skewY: 0, + strokeUniform: false }; var cObj = new fabric.Object(); diff --git a/test/unit/path.js b/test/unit/path.js index a4dd9c43630..8b8966260cd 100644 --- a/test/unit/path.js +++ b/test/unit/path.js @@ -1,37 +1,38 @@ (function() { var REFERENCE_PATH_OBJECT = { - 'version': fabric.version, - 'type': 'path', - 'originX': 'left', - 'originY': 'top', - 'left': 100, - 'top': 100, - 'width': 200, - 'height': 200, - 'fill': 'red', - 'stroke': 'blue', - 'strokeWidth': 1, - 'strokeDashArray': null, - 'strokeLineCap': 'butt', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'miter', - 'strokeMiterLimit': 4, - 'scaleX': 1, - 'scaleY': 1, - 'angle': 0, - 'flipX': false, - 'flipY': false, - 'opacity': 1, - 'path': [['M', 100, 100], ['L', 300, 100], ['L', 200, 300], ['z']], - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', - 'skewX': 0, - 'skewY': 0, + version: fabric.version, + type: 'path', + originX: 'left', + originY: 'top', + left: 100, + top: 100, + width: 200, + height: 200, + fill: 'red', + stroke: 'blue', + strokeWidth: 1, + strokeDashArray: null, + strokeLineCap: 'butt', + strokeDashOffset: 0, + strokeLineJoin: 'miter', + strokeMiterLimit: 4, + scaleX: 1, + scaleY: 1, + angle: 0, + flipX: false, + flipY: false, + opacity: 1, + path: [['M', 100, 100], ['L', 300, 100], ['L', 200, 300], ['z']], + shadow: null, + visible: true, + backgroundColor: '', + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + skewX: 0, + skewY: 0, + strokeUniform: false }; function getPathElement(path) { diff --git a/test/unit/polygon.js b/test/unit/polygon.js index db3d28f4096..0aaa3dca599 100644 --- a/test/unit/polygon.js +++ b/test/unit/polygon.js @@ -8,45 +8,46 @@ } var REFERENCE_OBJECT = { - 'version': fabric.version, - 'type': 'polygon', - 'originX': 'left', - 'originY': 'top', - 'left': 9.5, - 'top': 11.5, - 'width': 10, - 'height': 10, - 'fill': 'rgb(0,0,0)', - 'stroke': null, - 'strokeWidth': 1, - 'strokeDashArray': null, - 'strokeLineCap': 'butt', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'miter', - 'strokeMiterLimit': 4, - 'scaleX': 1, - 'scaleY': 1, - 'angle': 0, - 'flipX': false, - 'flipY': false, - 'opacity': 1, - 'points': getPoints(), - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', - 'skewX': 0, - 'skewY': 0, + version: fabric.version, + type: 'polygon', + originX: 'left', + originY: 'top', + left: 9.5, + top: 11.5, + width: 10, + height: 10, + fill: 'rgb(0,0,0)', + stroke: null, + strokeWidth: 1, + strokeDashArray: null, + strokeLineCap: 'butt', + strokeDashOffset: 0, + strokeLineJoin: 'miter', + strokeMiterLimit: 4, + scaleX: 1, + scaleY: 1, + angle: 0, + flipX: false, + flipY: false, + opacity: 1, + points: getPoints(), + shadow: null, + visible: true, + backgroundColor: '', + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + skewX: 0, + skewY: 0, + strokeUniform: false }; var REFERENCE_EMPTY_OBJECT = { - 'points': [], - 'width': 0, - 'height': 0, - 'top': 0, - 'left': 0 + points: [], + width: 0, + height: 0, + top: 0, + left: 0 }; QUnit.module('fabric.Polygon'); @@ -157,19 +158,19 @@ { x: 10, y: 10 } ]; assert.deepEqual(polygonWithAttrs.toObject(), fabric.util.object.extend(REFERENCE_OBJECT, { - 'width': 20, - 'height': 20, - 'fill': 'rgb(255,255,255)', - 'stroke': 'blue', - 'strokeWidth': 3, - 'strokeDashArray': [5, 2], - 'strokeLineCap': 'round', - 'strokeLineJoin': 'bevel', - 'strokeMiterLimit': 5, - 'opacity': 0.34, - 'points': expectedPoints, - 'top': 10, - 'left': 10, + width: 20, + height: 20, + fill: 'rgb(255,255,255)', + stroke: 'blue', + strokeWidth: 3, + strokeDashArray: [5, 2], + strokeLineCap: 'round', + strokeLineJoin: 'bevel', + strokeMiterLimit: 5, + opacity: 0.34, + points: expectedPoints, + top: 10, + left: 10, })); }); }); diff --git a/test/unit/polyline.js b/test/unit/polyline.js index 211882ed319..2843509e8d4 100644 --- a/test/unit/polyline.js +++ b/test/unit/polyline.js @@ -8,45 +8,46 @@ } var REFERENCE_OBJECT = { - 'version': fabric.version, - 'type': 'polyline', - 'originX': 'left', - 'originY': 'top', - 'left': 9.5, - 'top': 11.5, - 'width': 10, - 'height': 10, - 'fill': 'rgb(0,0,0)', - 'stroke': null, - 'strokeWidth': 1, - 'strokeDashArray': null, - 'strokeLineCap': 'butt', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'miter', - 'strokeMiterLimit': 4, - 'scaleX': 1, - 'scaleY': 1, - 'angle': 0, - 'flipX': false, - 'flipY': false, - 'opacity': 1, - 'points': getPoints(), - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', - 'skewX': 0, - 'skewY': 0, + version: fabric.version, + type: 'polyline', + originX: 'left', + originY: 'top', + left: 9.5, + top: 11.5, + width: 10, + height: 10, + fill: 'rgb(0,0,0)', + stroke: null, + strokeWidth: 1, + strokeDashArray: null, + strokeLineCap: 'butt', + strokeDashOffset: 0, + strokeLineJoin: 'miter', + strokeMiterLimit: 4, + scaleX: 1, + scaleY: 1, + angle: 0, + flipX: false, + flipY: false, + opacity: 1, + points: getPoints(), + shadow: null, + visible: true, + backgroundColor: '', + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + skewX: 0, + skewY: 0, + strokeUniform: false }; var REFERENCE_EMPTY_OBJECT = { - 'points': [], - 'width': 0, - 'height': 0, - 'top': 0, - 'left': 0 + points: [], + width: 0, + height: 0, + top: 0, + left: 0 }; QUnit.module('fabric.Polyline'); @@ -147,19 +148,19 @@ fabric.Polyline.fromElement(elPolylineWithAttrs, function(polylineWithAttrs) { var expectedPoints = [{x: 10, y: 10}, {x: 20, y: 20}, {x: 30, y: 30}, {x: 10, y: 10}]; assert.deepEqual(polylineWithAttrs.toObject(), fabric.util.object.extend(REFERENCE_OBJECT, { - 'width': 20, - 'height': 20, - 'fill': 'rgb(255,255,255)', - 'stroke': 'blue', - 'strokeWidth': 3, - 'strokeDashArray': [5, 2], - 'strokeLineCap': 'round', - 'strokeLineJoin': 'bevel', - 'strokeMiterLimit': 5, - 'opacity': 0.34, - 'points': expectedPoints, - 'left': 10, - 'top': 10, + width: 20, + height: 20, + fill: 'rgb(255,255,255)', + stroke: 'blue', + strokeWidth: 3, + strokeDashArray: [5, 2], + strokeLineCap: 'round', + strokeLineJoin: 'bevel', + strokeMiterLimit: 5, + opacity: 0.34, + points: expectedPoints, + left: 10, + top: 10, })); }); }); diff --git a/test/unit/rect.js b/test/unit/rect.js index 3994dd34596..dc96f6fc3c6 100644 --- a/test/unit/rect.js +++ b/test/unit/rect.js @@ -1,38 +1,39 @@ (function() { var REFERENCE_RECT = { - 'version': fabric.version, - 'type': 'rect', - 'originX': 'left', - 'originY': 'top', - 'left': 0, - 'top': 0, - 'width': 0, - 'height': 0, - 'fill': 'rgb(0,0,0)', - 'stroke': null, - 'strokeWidth': 1, - 'strokeDashArray': null, - 'strokeLineCap': 'butt', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'miter', - 'strokeMiterLimit': 4, - 'scaleX': 1, - 'scaleY': 1, - 'angle': 0, - 'flipX': false, - 'flipY': false, - 'opacity': 1, - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', - 'rx': 0, - 'ry': 0, - 'skewX': 0, - 'skewY': 0 + version: fabric.version, + type: 'rect', + originX: 'left', + originY: 'top', + left: 0, + top: 0, + width: 0, + height: 0, + fill: 'rgb(0,0,0)', + stroke: null, + strokeWidth: 1, + strokeDashArray: null, + strokeLineCap: 'butt', + strokeDashOffset: 0, + strokeLineJoin: 'miter', + strokeMiterLimit: 4, + scaleX: 1, + scaleY: 1, + angle: 0, + flipX: false, + flipY: false, + opacity: 1, + shadow: null, + visible: true, + backgroundColor: '', + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + rx: 0, + ry: 0, + skewX: 0, + skewY: 0, + strokeUniform: false }; QUnit.module('fabric.Rect'); @@ -78,8 +79,8 @@ assert.deepEqual(rect.toObject(), REFERENCE_RECT); var expectedObject = fabric.util.object.extend({ }, REFERENCE_RECT); - expectedObject.fill = {'type': 'linear','coords': {'x1': 0,'y1': 0,'x2': 200,'y2': 0},'colorStops': [{'offset': '0','color': 'rgb(255,0,0)','opacity': 1},{'offset': '1','color': 'rgb(0,0,255)','opacity': 1}],'offsetX': 0,'offsetY': 0}; - expectedObject.stroke = {'type': 'linear','coords': {'x1': 0,'y1': 0,'x2': 200,'y2': 0},'colorStops': [{'offset': '0','color': 'rgb(255,0,0)','opacity': 1},{'offset': '1','color': 'rgb(0,0,255)','opacity': 1}],'offsetX': 0,'offsetY': 0}; + expectedObject.fill = {type: 'linear',coords: {x1: 0,y1: 0,x2: 200,y2: 0},colorStops: [{offset: '0',color: 'rgb(255,0,0)',opacity: 1},{offset: '1',color: 'rgb(0,0,255)',opacity: 1}],offsetX: 0,offsetY: 0}; + expectedObject.stroke = {type: 'linear',coords: {x1: 0,y1: 0,x2: 200,y2: 0},colorStops: [{offset: '0',color: 'rgb(255,0,0)',opacity: 1},{offset: '1',color: 'rgb(0,0,255)',opacity: 1}],offsetX: 0,offsetY: 0}; fabric.Rect.fromObject(expectedObject, function(rect2) { assert.ok(rect2.fill instanceof fabric.Gradient); assert.ok(rect2.stroke instanceof fabric.Gradient); @@ -150,7 +151,7 @@ strokeMiterLimit: 5, rx: 11, ry: 12, - // strokeUniform: true + strokeUniform: true }); assert.deepEqual(rectWithAttrs.toObject(), expectedObject); }); diff --git a/test/unit/text.js b/test/unit/text.js index dbadcb432cb..3e193c5e308 100644 --- a/test/unit/text.js +++ b/test/unit/text.js @@ -9,49 +9,50 @@ var CHAR_WIDTH = 20; var REFERENCE_TEXT_OBJECT = { - 'version': fabric.version, - 'type': 'text', - 'originX': 'left', - 'originY': 'top', - 'left': 0, - 'top': 0, - 'width': CHAR_WIDTH, - 'height': 45.2, - 'fill': 'rgb(0,0,0)', - 'stroke': null, - 'strokeWidth': 1, - 'strokeDashArray': null, - 'strokeLineCap': 'butt', - 'strokeDashOffset': 0, - 'strokeLineJoin': 'miter', - 'strokeMiterLimit': 4, - 'scaleX': 1, - 'scaleY': 1, - 'angle': 0, - 'flipX': false, - 'flipY': false, - 'opacity': 1, - 'shadow': null, - 'visible': true, - 'backgroundColor': '', - 'text': 'x', - 'fontSize': 40, - 'fontWeight': 'normal', - 'fontFamily': 'Times New Roman', - 'fontStyle': 'normal', - 'lineHeight': 1.16, - 'underline': false, - 'overline': false, - 'linethrough': false, - 'textAlign': 'left', - 'textBackgroundColor': '', - 'fillRule': 'nonzero', - 'paintFirst': 'fill', - 'globalCompositeOperation': 'source-over', - 'skewX': 0, - 'skewY': 0, - 'charSpacing': 0, - 'styles': {} + version: fabric.version, + type: 'text', + originX: 'left', + originY: 'top', + left: 0, + top: 0, + width: CHAR_WIDTH, + height: 45.2, + fill: 'rgb(0,0,0)', + stroke: null, + strokeWidth: 1, + strokeDashArray: null, + strokeLineCap: 'butt', + strokeDashOffset: 0, + strokeLineJoin: 'miter', + strokeMiterLimit: 4, + scaleX: 1, + scaleY: 1, + angle: 0, + flipX: false, + flipY: false, + opacity: 1, + shadow: null, + visible: true, + backgroundColor: '', + text: 'x', + fontSize: 40, + fontWeight: 'normal', + fontFamily: 'Times New Roman', + fontStyle: 'normal', + lineHeight: 1.16, + underline: false, + overline: false, + linethrough: false, + textAlign: 'left', + textBackgroundColor: '', + fillRule: 'nonzero', + paintFirst: 'fill', + globalCompositeOperation: 'source-over', + skewX: 0, + skewY: 0, + charSpacing: 0, + styles: {}, + strokeUniform: false }; QUnit.test('constructor', function(assert) { diff --git a/test/unit/textbox.js b/test/unit/textbox.js index 7d1a511ca4a..71e5dcc923d 100644 --- a/test/unit/textbox.js +++ b/test/unit/textbox.js @@ -52,6 +52,7 @@ styles: { }, minWidth: 20, splitByGrapheme: false, + strokeUniform: false }; QUnit.test('constructor', function(assert) {