From 496b8ecd0f3eb1e1cc47a06ff40a25d297128d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 16 Jun 2015 12:56:53 +0200 Subject: [PATCH] Implement unit test for issue #708. --- test/tests/Curve.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/tests/Curve.js b/test/tests/Curve.js index 3fb81519..0bc72462 100644 --- a/test/tests/Curve.js +++ b/test/tests/Curve.js @@ -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],