Skip to content

Commit d761c6c

Browse files
committed
Implement tests for Curve#getPointAt().
More to come.
1 parent ccd0bf8 commit d761c6c

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

test/tests/Curve.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
3+
* http://paperjs.org/
4+
*
5+
* Copyright (c) 2011 - 2013, Juerg Lehni & Jonathan Puckey
6+
* http://lehni.org/ & http://jonathanpuckey.com/
7+
*
8+
* Distributed under the MIT license. See LICENSE file for details.
9+
*
10+
* All rights reserved.
11+
*/
12+
13+
module('Curve');
14+
15+
test('Curve#getPointAt()', function() {
16+
var curve = new Path.Circle({
17+
center: [100, 100],
18+
radius: 100
19+
}).getFirstCurve();
20+
21+
var points = [
22+
[0, new Point(0, 100)],
23+
[0.25, new Point(7.8585, 61.07549)],
24+
[0.5, new Point(29.28932, 29.28932)],
25+
[0.75, new Point(61.07549, 7.8585)],
26+
[1, new Point(100, 0)]
27+
];
28+
29+
for (var i = 0; i < points.length; i++) {
30+
var entry = points[i];
31+
comparePoints(curve.getPointAt(entry[0], true), entry[1],
32+
'curve.getPointAt(' + entry[0] + ', true);');
33+
}
34+
});

test/tests/load.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
/*#*/ include('Path.js');
3333
/*#*/ include('Style.js');
34+
/*#*/ include('Curve.js');
3435
/*#*/ include('Path_Shapes.js');
3536
/*#*/ include('Path_Drawing_Commands.js');
3637
/*#*/ include('Path_Curves.js');

0 commit comments

Comments
 (0)