mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Fix wrong assumptions in Path.Constructor tests.
This commit is contained in:
parent
9c5c7997d4
commit
1cb1da0b26
1 changed files with 9 additions and 9 deletions
|
@ -17,10 +17,10 @@ test('new Path.Rectangle([50, 50], [100, 100])', function() {
|
|||
equals(path.segments.toString(), '{ point: { x: 50, y: 150 } },{ point: { x: 50, y: 50 } },{ point: { x: 150, y: 50 } },{ point: { x: 150, y: 150 } }');
|
||||
});
|
||||
|
||||
test('new Path.Rectangle({from: [50, 50], to: [100, 100]})', function() {
|
||||
test('new Path.Rectangle({ from: [50, 50], to: [150, 150] })', function() {
|
||||
var path = new Path.Rectangle({
|
||||
from: [50, 50],
|
||||
to: [100, 100]
|
||||
to: [150, 150]
|
||||
});
|
||||
equals(path.segments.toString(), '{ point: { x: 50, y: 150 } },{ point: { x: 50, y: 50 } },{ point: { x: 150, y: 50 } },{ point: { x: 150, y: 150 } }');
|
||||
});
|
||||
|
@ -30,7 +30,7 @@ test('new Path.Circle([100, 100], 50)', function() {
|
|||
equals(path.segments.toString(), '{ point: { x: 50, y: 100 }, handleIn: { x: 0, y: 27.61424 }, handleOut: { x: 0, y: -27.61424 } },{ point: { x: 100, y: 50 }, handleIn: { x: -27.61424, y: 0 }, handleOut: { x: 27.61424, y: 0 } },{ point: { x: 150, y: 100 }, handleIn: { x: 0, y: -27.61424 }, handleOut: { x: 0, y: 27.61424 } },{ point: { x: 100, y: 150 }, handleIn: { x: 27.61424, y: 0 }, handleOut: { x: -27.61424, y: 0 } }');
|
||||
});
|
||||
|
||||
test('new Path.Circle({center: [100, 100], radius: 50})', function() {
|
||||
test('new Path.Circle({ center: [100, 100], radius: 50 })', function() {
|
||||
var path = new Path.Circle({center: [100, 100], radius: 50});
|
||||
equals(path.segments.toString(), '{ point: { x: 50, y: 100 }, handleIn: { x: 0, y: 27.61424 }, handleOut: { x: 0, y: -27.61424 } },{ point: { x: 100, y: 50 }, handleIn: { x: -27.61424, y: 0 }, handleOut: { x: 27.61424, y: 0 } },{ point: { x: 150, y: 100 }, handleIn: { x: 0, y: -27.61424 }, handleOut: { x: 0, y: 27.61424 } },{ point: { x: 100, y: 150 }, handleIn: { x: 27.61424, y: 0 }, handleOut: { x: -27.61424, y: 0 } }');
|
||||
});
|
||||
|
@ -47,11 +47,11 @@ test('new Path.RoundRectangle(rectangle, radius)', function() {
|
|||
equals(path.segments.toString(), '{ point: { x: 70, y: 150 }, handleOut: { x: -11.04569, y: 0 } },{ point: { x: 50, y: 130 }, handleIn: { x: 0, y: 11.04569 } },{ point: { x: 50, y: 70 }, handleOut: { x: 0, y: -11.04569 } },{ point: { x: 70, y: 50 }, handleIn: { x: -11.04569, y: 0 } },{ point: { x: 230, y: 50 }, handleOut: { x: 11.04569, y: 0 } },{ point: { x: 250, y: 70 }, handleIn: { x: 0, y: -11.04569 } },{ point: { x: 250, y: 130 }, handleOut: { x: 0, y: 11.04569 } },{ point: { x: 230, y: 150 }, handleIn: { x: 11.04569, y: 0 } }');
|
||||
});
|
||||
|
||||
test('new Path.RoundRectangle({rectangle: rectangle, radius: radius})', function() {
|
||||
test('new Path.RoundRectangle({ rectangle: rectangle, radius: radius })', function() {
|
||||
var rect = new Rectangle({
|
||||
point: [50, 50],
|
||||
size: new Size([200, 100]
|
||||
) });
|
||||
size: [200, 100]
|
||||
});
|
||||
var path = new Path.RoundRectangle({
|
||||
rectangle: rect,
|
||||
radius: 20
|
||||
|
@ -70,7 +70,7 @@ test('new Path.Arc(from, through, to)', function() {
|
|||
equals(path.segments.toString(), '{ point: { x: 0, y: 20 }, handleOut: { x: -2.62559, y: 23.01251 } },{ point: { x: 30.89325, y: 74.75812 }, handleIn: { x: -21.05455, y: -9.65273 }, handleOut: { x: 21.05455, y: 9.65273 } },{ point: { x: 92.54397, y: 62.42797 }, handleIn: { x: -15.72238, y: 17.00811 }, handleOut: { x: 15.72238, y: -17.00811 } },{ point: { x: 100, y: 0 }, handleIn: { x: 11.27458, y: 20.23247 } }');
|
||||
});
|
||||
|
||||
test('new Path.Arc({ from: from, through: through, to: to})', function() {
|
||||
test('new Path.Arc({ from: from, through: through, to: to })', function() {
|
||||
var path = new Path.Arc({ from: [0, 20], through: [75, 75], to: [100, 0]});
|
||||
equals(path.segments.toString(), '{ point: { x: 0, y: 20 }, handleOut: { x: -2.62559, y: 23.01251 } },{ point: { x: 30.89325, y: 74.75812 }, handleIn: { x: -21.05455, y: -9.65273 }, handleOut: { x: 21.05455, y: 9.65273 } },{ point: { x: 92.54397, y: 62.42797 }, handleIn: { x: -15.72238, y: 17.00811 }, handleOut: { x: 15.72238, y: -17.00811 } },{ point: { x: 100, y: 0 }, handleIn: { x: 11.27458, y: 20.23247 } }');
|
||||
});
|
||||
|
@ -83,7 +83,7 @@ test('new Path.RegularPolygon(center, numSides, radius)', function() {
|
|||
equals(path.segments.toString(), '{ point: { x: 219.0983, y: 345.10565 } },{ point: { x: 169.0983, y: 308.77853 } },{ point: { x: 150, y: 250 } },{ point: { x: 169.0983, y: 191.22147 } },{ point: { x: 219.0983, y: 154.89435 } },{ point: { x: 280.9017, y: 154.89435 } },{ point: { x: 330.9017, y: 191.22147 } },{ point: { x: 350, y: 250 } },{ point: { x: 330.9017, y: 308.77853 } },{ point: { x: 280.9017, y: 345.10565 } }');
|
||||
});
|
||||
|
||||
test('new Path.RegularPolygon({center: center, numSides: numSides, radius: radius })', function() {
|
||||
test('new Path.RegularPolygon({ center: center, numSides: numSides, radius: radius })', function() {
|
||||
var path = new Path.RegularPolygon({center: new Point(50, 50), numSides: 3, radius: 10});
|
||||
equals(path.segments.toString(), '{ point: { x: 41.33975, y: 55 } },{ point: { x: 50, y: 40 } },{ point: { x: 58.66025, y: 55 } }');
|
||||
|
||||
|
@ -100,7 +100,7 @@ test('new Path.Star(center, numPoints, radius1, radius2)', function() {
|
|||
equals(path.segments.toString(), '{ point: { x: 100, y: 80 } },{ point: { x: 105.87785, y: 91.90983 } },{ point: { x: 119.02113, y: 93.81966 } },{ point: { x: 109.51057, y: 103.09017 } },{ point: { x: 111.75571, y: 116.18034 } },{ point: { x: 100, y: 110 } },{ point: { x: 88.24429, y: 116.18034 } },{ point: { x: 90.48943, y: 103.09017 } },{ point: { x: 80.97887, y: 93.81966 } },{ point: { x: 94.12215, y: 91.90983 } }');
|
||||
});
|
||||
|
||||
test('new Path.Star({center: center, numPoints: numPoints, radius1: radius1, radius2: radius2})', function() {
|
||||
test('new Path.Star({ center: center, numPoints: numPoints, radius1: radius1, radius2: radius2 })', function() {
|
||||
var path = new Path.Star({
|
||||
center: new Point(100, 100),
|
||||
numPoints: 10,
|
||||
|
|
Loading…
Reference in a new issue