From 0f80b11a071b5069fdbc3375c5b24edd63aafa87 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Mon, 11 Apr 2011 18:58:32 +0200 Subject: [PATCH] Add failing test for Curve#getParameter on a straight curve. --- test/tests/Path_Length.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/tests/Path_Length.js b/test/tests/Path_Length.js index 2952cfcb..115c6139 100644 --- a/test/tests/Path_Length.js +++ b/test/tests/Path_Length.js @@ -29,3 +29,14 @@ test('path.length', function() { // 4: 0.22558508917324532 compareNumbers(param, 0.2255849553116685); }); + +test('curve.getParameter with straight curve', function() { + var doc = new Document(); + var path = new Path(); + path.moveTo(100, 100); + path.lineTo(500, 500); + var curve = path.curves[0]; + var length = curve.length; + var t = curve.getParameter(length / 3); + compareNumbers(t, 0.3869631475722452); +});