Index: LayoutTests/svg/custom/path-getTotalLength.svg |
diff --git a/LayoutTests/svg/custom/path-getTotalLength.svg b/LayoutTests/svg/custom/path-getTotalLength.svg |
index acf4ba9fafa459fd77edd75c3c8e6fe111f48d58..e163a511f19231e2bdc4a63d0846606a53e377aa 100644 |
--- a/LayoutTests/svg/custom/path-getTotalLength.svg |
+++ b/LayoutTests/svg/custom/path-getTotalLength.svg |
@@ -7,7 +7,6 @@ |
var svgNS = "http://www.w3.org/2000/svg"; |
var pathElement = document.createElementNS(svgNS, 'path'); |
- var errorTolerance = .1; |
var logOffset = 20; |
function result(didPass, string) { |
@@ -28,28 +27,30 @@ |
document.getElementById('log').appendChild(newText); |
} |
- function expectLength(path, expectedLength) { |
+ function expectLength(path, expectedLength, errorTolerance) { |
pathElement.setAttribute("d", path); |
var actualLength; |
try { |
actualLength = pathElement.getTotalLength(); |
if (Math.abs(actualLength - expectedLength) < errorTolerance) |
- result(true, path + "\" = " + actualLength); |
+ result(true, path + " = " + actualLength); |
else |
- result(false, path + "\" expected: " + expectedLength + " actual: " + actualLength); |
+ result(false, path + " expected: " + expectedLength + " actual: " + actualLength); |
} catch(e) { |
- result(false, path + "\" expected: " + expectedLength + " got exception: " + e); |
+ result(false, path + " expected: " + expectedLength + " got exception: " + e); |
} |
} |
var errorCount = 0; |
// Tests go here: |
- expectLength('M 0 0 L 100 0 L 100 100 L 0 100 Z', 400); |
- expectLength('M 0 0 l 100 0 l 0 100 l -100 0 Z', 400); |
- expectLength('M 0 0 t 0 100', 100); |
- expectLength('M 0 0 Q 55 50 100 100', 141.4); // I'm not sure if this is actually right |
+ expectLength('M 0 0 L 100 0 L 100 100 L 0 100 Z', 400, 0.000001); |
+ expectLength('M 0 0 l 100 0 l 0 100 l -100 0 Z', 400, 0.000001); |
+ expectLength('M 0 0 t 0 100', 100, 0.1); |
+ expectLength('M 0 0 Q 55 50 100 100', 141.4803314, 0.000001); |
+ expectLength('M 778.4191616766467 375.19086364081954 C 781.239563 375.1908569 786.8525244750526 346.60170830052556 786.8802395209582 346.87991373394766', 29.86020, 0.0001); |
+ expectLength('M 0 0 C 0.00001 0.00001 0.00002 0.00001 0.00003 0', 0.0000344338, 0.000000001); |
]]> |
</script> |
</svg> |