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

Unified 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, 2 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
Index: third_party/WebKit/LayoutTests/svg/dom/SVGGeometryElement-getTotalLength-detached.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGGeometryElement-getTotalLength-detached.html b/third_party/WebKit/LayoutTests/svg/dom/SVGGeometryElement-getTotalLength-detached.html
new file mode 100644
index 0000000000000000000000000000000000000000..afe304300212e08091456a674782ea2cf22108a3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGGeometryElement-getTotalLength-detached.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<title>SVGGeometryElement.getTotalLength method (element detached)</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ var pathElement = document.createElementNS("http://www.w3.org/2000/svg", "path");
+
+ function getTotalLength(string) {
+ pathElement.setAttribute("d", string);
+ return pathElement.getTotalLength();
+ }
+
+ assert_equals(getTotalLength('M0,20 L400,20 L640,20'), 640);
+ assert_equals(getTotalLength('M0,20 L400,20 L640,20 z'), 1280);
+ assert_equals(getTotalLength('M0,20 L400,20 z M 320,20 L640,20'), 1120);
+}, document.title + " with SVGPathElement");
+
+test(function() {
+ var rectElement = document.createElementNS("http://www.w3.org/2000/svg", "rect");
+
+ function getTotalLength(rx, ry, width, height) {
+ rectElement.setAttribute("rx", rx);
+ rectElement.setAttribute("ry", ry);
+ rectElement.setAttribute("width", width);
+ rectElement.setAttribute("height", height);
+
+ return rectElement.getTotalLength();
+ }
+
+ assert_equals(getTotalLength(0, 0, 200, 300), 0);
+ assert_equals(getTotalLength(50, 50, 200, 300), 0);
+}, document.title + " with SVGRectElement");
+
+test(function() {
+ var circleElement = document.createElementNS("http://www.w3.org/2000/svg", "circle");
+
+ circleElement.setAttribute("r", 10);
+ assert_equals(circleElement.getTotalLength(), 0);
+ circleElement.setAttribute("r", 20);
+ assert_equals(circleElement.getTotalLength(), 0);
+}, document.title + " with SVGCircleElement");
+</script>

Powered by Google App Engine
This is Rietveld 408576698