summaryrefslogtreecommitdiffstats
path: root/dom/svg/test/test_getTotalLength.xhtml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /dom/svg/test/test_getTotalLength.xhtml
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/svg/test/test_getTotalLength.xhtml')
-rw-r--r--dom/svg/test/test_getTotalLength.xhtml57
1 files changed, 57 insertions, 0 deletions
diff --git a/dom/svg/test/test_getTotalLength.xhtml b/dom/svg/test/test_getTotalLength.xhtml
new file mode 100644
index 0000000000..0809f40ca1
--- /dev/null
+++ b/dom/svg/test/test_getTotalLength.xhtml
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1474284
+-->
+<head>
+ <title>Test for Bug 1474284</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1474284">Mozilla Bug 1474284</a>
+<p id="display"></p>
+
+<svg xmlns="http://www.w3.org/2000/svg">
+ <path id="path1" stroke="#000" fill="none"
+ d="M 50,40
+ C 50,40 0,60 30,20"/>
+ <symbol font-size="10" width="20em" height="20em">
+ <rect id="r1" x="5em" y="6em" width="20%" height="30%" />
+ </symbol>
+</svg>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+SimpleTest.waitForExplicitFinish();
+
+function run() {
+ isfuzzy(document.getElementById("path1").getTotalLength(),
+ 55.19, 0.02,
+ 'getTotalLength() on element id="path1" returned the wrong value');
+
+ let r1 = document.getElementById("r1");
+ is(r1.getTotalLength(), 200, "getTotalLength() should work for non-rendered element");
+
+ let r2 = document.createElementNS("http://www.w3.org/2000/svg", "rect");
+ r2.setAttribute("width", 200);
+ r2.setAttribute("height", 300);
+ is(r2.getTotalLength(), 1000, "getTotalLength() should work for a rect element not in the document");
+
+ let c = document.createElementNS("http://www.w3.org/2000/svg", "circle");
+ c.setAttribute("r", 200);
+ isfuzzy(c.getTotalLength(), 2 * Math.PI * 200, 0.2, "getTotalLength() should work for a circle element not in the document");
+
+ let e = document.createElementNS("http://www.w3.org/2000/svg", "ellipse");
+ e.setAttribute("rx", 200);
+ e.setAttribute("ry", 200);
+ isfuzzy(e.getTotalLength(), 2 * Math.PI * 200, 0.2, "getTotalLength() should work for an ellipse element not in the document");
+
+ SimpleTest.finish();
+}
+
+window.addEventListener("load", run);
+</script>
+</pre>
+</body>
+</html>