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

Side by Side Diff: third_party/WebKit/LayoutTests/svg/dom/SVGGeometryElement-getTotalLength-detached.html

Issue 2413753004: Move getTotalLength and getPointAtLength methods from SVGPathElement to SVGGeometryElement. (Closed)
Patch Set: Align with review comments Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>SVGGeometryElement.getTotalLength method (element detached)</title>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <script>
6 test(function() {
7 var pathElement = document.createElementNS("http://www.w3.org/2000/svg", "path ");
8
9 function getTotalLength(string) {
10 pathElement.setAttribute("d", string);
11 return pathElement.getTotalLength();
12 }
13
14 assert_equals(getTotalLength('M0,20 L400,20 L640,20'), 640);
15 assert_equals(getTotalLength('M0,20 L400,20 L640,20 z'), 1280);
16 assert_equals(getTotalLength('M0,20 L400,20 z M 320,20 L640,20'), 1120);
17 }, document.title + " with SVGPathElement");
18
19 test(function() {
20 var rectElement = document.createElementNS("http://www.w3.org/2000/svg", "rect ");
21
22 function getTotalLength(rx, ry, width, height) {
23 rectElement.setAttribute("rx", rx);
24 rectElement.setAttribute("ry", ry);
25 rectElement.setAttribute("width", width);
26 rectElement.setAttribute("height", height);
27
28 return rectElement.getTotalLength();
29 }
30
31 assert_equals(getTotalLength(0, 0, 200, 300), 0);
32 assert_equals(getTotalLength(50, 50, 200, 300), 0);
33 }, document.title + " with SVGRectElement");
34
35 test(function() {
36 var circleElement = document.createElementNS("http://www.w3.org/2000/svg", "ci rcle");
37
38 circleElement.setAttribute("r", 10);
39 assert_equals(circleElement.getTotalLength(), 0);
40 circleElement.setAttribute("r", 20);
41 assert_equals(circleElement.getTotalLength(), 0);
42 }, document.title + " with SVGCircleElement");
43 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698