Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: LayoutTests/svg/custom/path-getTotalLength.svg

Issue 233063003: Improve the reliability and accuracy of SVG getTotalLength (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Improved Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/svg/custom/path-getTotalLength-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/svg/custom/path-getTotalLength-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698