mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
07b58e928e
Currently failing for rect.
55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
/*
|
|
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
* http://paperjs.org/
|
|
*
|
|
* Copyright (c) 2011 - 2014, Juerg Lehni & Jonathan Puckey
|
|
* http://scratchdisk.com/ & http://jonathanpuckey.com/
|
|
*
|
|
* Distributed under the MIT license. See LICENSE file for details.
|
|
*
|
|
* All rights reserved.
|
|
*/
|
|
|
|
module('Shape');
|
|
|
|
test('shape.toPath().toShape()', function() {
|
|
var shapes = {
|
|
circle: new Shape.Circle({
|
|
center: [100, 100],
|
|
radius: 50,
|
|
fillColor: 'red'
|
|
}),
|
|
|
|
ellipse: new Shape.Ellipse({
|
|
center: [100, 200],
|
|
radius: [50, 25],
|
|
fillColor: 'blue',
|
|
strokeColor: 'black',
|
|
strokeWidth: 4,
|
|
rotation: 20
|
|
}),
|
|
|
|
rect: new Shape.Rectangle({
|
|
center: [100, 300],
|
|
size: [100, 50],
|
|
fillColor: 'green',
|
|
strokeColor: 'black',
|
|
strokeWidth: 4,
|
|
rotation: -20
|
|
}),
|
|
|
|
roundRect: new Shape.Rectangle({
|
|
center: [100, 400],
|
|
size: [50, 100],
|
|
radius: [15, 20],
|
|
fillColor: 'orange',
|
|
strokeColor: 'black',
|
|
strokeWidth: 4,
|
|
rotation: 20
|
|
})
|
|
};
|
|
|
|
Base.each(shapes, function(shape, name) {
|
|
equals(shape, shape.toPath().toShape(), name + '.toPath().toShape()');
|
|
});
|
|
});
|