mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Implement unit test for issue #708.
This commit is contained in:
parent
ce41447793
commit
496b8ecd0f
1 changed files with 24 additions and 0 deletions
|
@ -12,6 +12,30 @@
|
|||
|
||||
module('Curve');
|
||||
|
||||
test('Curve#getParameterOf()', function() {
|
||||
// For issue #708:
|
||||
var path = new Path.Rectangle({
|
||||
center: new Point(300, 100),
|
||||
size: new Point(100, 100),
|
||||
strokeColor: 'black'
|
||||
});
|
||||
|
||||
for (var pos = 0; pos < path.length; pos += 10) {
|
||||
var point1 = path.getPointAt(pos),
|
||||
point2 = null;
|
||||
for (var i = 0; i < path.curves.length; i++) {
|
||||
var curve = path.curves[i];
|
||||
var parameter = curve.getParameterOf(point1);
|
||||
if (parameter) {
|
||||
point2 = curve.getLocationAt(parameter, true).point;
|
||||
break;
|
||||
}
|
||||
}
|
||||
equals(point1, point2, 'curve.getLocationAt(curve.getParameterOf('
|
||||
+ point1 + ')).point;');
|
||||
}
|
||||
});
|
||||
|
||||
test('Curve#getPointAt()', function() {
|
||||
var curve = new Path.Circle({
|
||||
center: [100, 100],
|
||||
|
|
Loading…
Reference in a new issue