Fix unit tests.

This commit is contained in:
kangax 2012-10-14 02:53:25 +02:00
parent 84a956c4b6
commit f9eeeb2916
14 changed files with 49 additions and 22 deletions

View file

@ -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();

View file

@ -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

View file

@ -80,6 +80,8 @@
'hasControls': true,
'hasBorders': true,
'hasRotatingPoint': false,
'transparentCorners': true,
'perPixelTargetFind': false,
'radius': 0
};
ok(typeof circle.toObject == 'function');

View file

@ -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());

View file

@ -139,6 +139,8 @@
'hasControls': true,
'hasBorders': true,
'hasRotatingPoint': false,
'transparentCorners': true,
'perPixelTargetFind': false,
'angle': 0,
'flipX': false,
'flipY': false,

View file

@ -36,6 +36,8 @@
'hasControls': true,
'hasBorders': true,
'hasRotatingPoint': false,
'transparentCorners': true,
'perPixelTargetFind': false,
'filters': []
};

View file

@ -24,7 +24,9 @@
'selectable': true,
'hasControls': true,
'hasBorders': true,
'hasRotatingPoint': false
'hasRotatingPoint': false,
'transparentCorners': true,
'perPixelTargetFind': false
};
QUnit.module('fabric.Line');

View file

@ -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());

View file

@ -21,7 +21,9 @@
'selectable': true,
'hasControls': true,
'hasBorders': true,
'hasRotatingPoint': false
'hasRotatingPoint': false,
'transparentCorners': true,
'perPixelTargetFind': false
};
function getPathElement(path) {

View file

@ -21,6 +21,8 @@
'hasControls': true,
'hasBorders': true,
'hasRotatingPoint': false,
'transparentCorners': true,
'perPixelTargetFind': false,
'paths': getPathObjects()
};

View file

@ -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');

View file

@ -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');

View file

@ -21,6 +21,8 @@
'hasControls': true,
'hasBorders': true,
'hasRotatingPoint': false,
'transparentCorners': true,
'perPixelTargetFind': false,
'rx': 0,
'ry': 0
};

View file

@ -27,6 +27,8 @@
'hasControls': true,
'hasBorders': true,
'hasRotatingPoint': false,
'transparentCorners': true,
'perPixelTargetFind': false,
'text': 'x',
'fontSize': 40,
'fontWeight': 100,