mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-19 19:01:52 +00:00
Fix unit tests.
This commit is contained in:
parent
84a956c4b6
commit
f9eeeb2916
14 changed files with 49 additions and 22 deletions
|
|
@ -23,12 +23,12 @@
|
|||
|
||||
var PATH_DATALESS_JSON = '{"objects":[{"type":"path","left":100,"top":100,"width":200,"height":200,"fill":"rgb(0,0,0)",'+
|
||||
'"overlayFill":null,"stroke":null,"strokeWidth":1,"strokeDashArray":null,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,'+
|
||||
'"flipY":false,"opacity":1,"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":false,'+
|
||||
'"flipY":false,"opacity":1,"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":false,"transparentCorners":true,"perPixelTargetFind":false,'+
|
||||
'"path":"http://example.com/"}],"background":"rgba(0, 0, 0, 0)"}';
|
||||
|
||||
var RECT_JSON = '{"objects":[{"type":"rect","left":0,"top":0,"width":10,"height":10,"fill":"rgb(0,0,0)","overlayFill":null,'+
|
||||
'"stroke":null,"strokeWidth":1,"strokeDashArray":null,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,'+
|
||||
'"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":false,"rx":0,"ry":0}],'+
|
||||
'"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":false,"transparentCorners":true,"perPixelTargetFind":false,"rx":0,"ry":0}],'+
|
||||
'"background":"#ff5555"}';
|
||||
|
||||
var canvas = this.canvas = fabric.isLikelyNode ? fabric.createCanvasForNode() : new fabric.Canvas();
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@
|
|||
|
||||
var PATH_DATALESS_JSON = '{"objects":[{"type":"path","left":100,"top":100,"width":200,"height":200,"fill":"rgb(0,0,0)",'+
|
||||
'"overlayFill":null,"stroke":null,"strokeWidth":1,"strokeDashArray":null,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,'+
|
||||
'"flipY":false,"opacity":1,"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":false,'+
|
||||
'"flipY":false,"opacity":1,"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":false,"transparentCorners":true,"perPixelTargetFind":false,'+
|
||||
'"path":"http://example.com/"}],"background":"rgba(0, 0, 0, 0)"}';
|
||||
|
||||
var RECT_JSON = '{"objects":[{"type":"rect","left":0,"top":0,"width":10,"height":10,"fill":"rgb(0,0,0)","overlayFill":null,'+
|
||||
'"stroke":null,"strokeWidth":1,"strokeDashArray":null,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"selectable":true,'+
|
||||
'"hasControls":true,"hasBorders":true,"hasRotatingPoint":false,"rx":0,"ry":0}],'+
|
||||
'"hasControls":true,"hasBorders":true,"hasRotatingPoint":false,"transparentCorners":true,"perPixelTargetFind":false,"rx":0,"ry":0}],'+
|
||||
'"background":"#ff5555"}';
|
||||
|
||||
// force creation of static canvas
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@
|
|||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false,
|
||||
'radius': 0
|
||||
};
|
||||
ok(typeof circle.toObject == 'function');
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
'overlayFill': null,
|
||||
'stroke': null,
|
||||
'strokeWidth': 1,
|
||||
'strokeDashArray': null,
|
||||
'strokeDashArray': null,
|
||||
'scaleX': 1,
|
||||
'scaleY': 1,
|
||||
'angle': 0,
|
||||
|
|
@ -43,7 +43,9 @@
|
|||
'selectable': true,
|
||||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false
|
||||
};
|
||||
ok(typeof ellipse.toObject == 'function');
|
||||
deepEqual(defaultProperties, ellipse.toObject());
|
||||
|
|
|
|||
|
|
@ -139,6 +139,8 @@
|
|||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false,
|
||||
'angle': 0,
|
||||
'flipX': false,
|
||||
'flipY': false,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@
|
|||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false,
|
||||
'filters': []
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@
|
|||
'selectable': true,
|
||||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false
|
||||
};
|
||||
|
||||
QUnit.module('fabric.Line');
|
||||
|
|
|
|||
|
|
@ -111,11 +111,11 @@
|
|||
test('toJSON', function() {
|
||||
var emptyObjectJSON = '{"type":"object","left":0,"top":0,"width":0,"height":0,"fill":"rgb(0,0,0)",'+
|
||||
'"overlayFill":null,"stroke":null,"strokeWidth":1,"strokeDashArray":null,"scaleX":1,"scaleY":1,"angle":0,'+
|
||||
'"flipX":false,"flipY":false,"opacity":1,"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":false}';
|
||||
'"flipX":false,"flipY":false,"opacity":1,"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":false,"transparentCorners":true,"perPixelTargetFind":false}';
|
||||
|
||||
var augmentedJSON = '{"type":"object","left":0,"top":0,"width":122,"height":0,"fill":"rgb(0,0,0)",'+
|
||||
'"overlayFill":null,"stroke":null,"strokeWidth":1,"strokeDashArray":null,"scaleX":1.3,"scaleY":1,"angle":0,'+
|
||||
'"flipX":false,"flipY":true,"opacity":0.88,"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":false}';
|
||||
'"flipX":false,"flipY":true,"opacity":0.88,"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":false,"transparentCorners":true,"perPixelTargetFind":false}';
|
||||
|
||||
var cObj = new fabric.Object();
|
||||
ok(typeof cObj.toJSON == 'function');
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
'overlayFill': null,
|
||||
'stroke': null,
|
||||
'strokeWidth': 1,
|
||||
'strokeDashArray': null,
|
||||
'strokeDashArray': null,
|
||||
'scaleX': 1,
|
||||
'scaleY': 1,
|
||||
'angle': 0,
|
||||
|
|
@ -146,8 +146,11 @@
|
|||
'selectable': true,
|
||||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false
|
||||
}
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false
|
||||
};
|
||||
|
||||
var augmentedObjectRepr = {
|
||||
'type': "object",
|
||||
'left': 10,
|
||||
|
|
@ -158,7 +161,7 @@
|
|||
'overlayFill': null,
|
||||
'stroke': null,
|
||||
'strokeWidth': 1,
|
||||
'strokeDashArray': null,
|
||||
'strokeDashArray': null,
|
||||
'scaleX': 1,
|
||||
'scaleY': 1,
|
||||
'angle': 0,
|
||||
|
|
@ -168,8 +171,10 @@
|
|||
'selectable': false,
|
||||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false
|
||||
}
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false
|
||||
};
|
||||
|
||||
var cObj = new fabric.Object();
|
||||
deepEqual(emptyObjectRepr, cObj.toObject());
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@
|
|||
'selectable': true,
|
||||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false
|
||||
};
|
||||
|
||||
function getPathElement(path) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false,
|
||||
'paths': getPathObjects()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,9 +26,11 @@
|
|||
'opacity': 1,
|
||||
'points': getPoints(),
|
||||
'selectable': true,
|
||||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false
|
||||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false
|
||||
};
|
||||
|
||||
QUnit.module('fabric.Polygon');
|
||||
|
|
|
|||
|
|
@ -26,9 +26,11 @@
|
|||
'opacity': 1,
|
||||
'points': getPoints(),
|
||||
'selectable': true,
|
||||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false
|
||||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false
|
||||
};
|
||||
|
||||
QUnit.module('fabric.Polyline');
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false,
|
||||
'rx': 0,
|
||||
'ry': 0
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
'hasControls': true,
|
||||
'hasBorders': true,
|
||||
'hasRotatingPoint': false,
|
||||
'transparentCorners': true,
|
||||
'perPixelTargetFind': false,
|
||||
'text': 'x',
|
||||
'fontSize': 40,
|
||||
'fontWeight': 100,
|
||||
|
|
|
|||
Loading…
Reference in a new issue