summaryrefslogtreecommitdiffstats
path: root/dom/svg/test/test_scientific.html
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_scientific.html
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_scientific.html')
-rw-r--r--dom/svg/test/test_scientific.html82
1 files changed, 82 insertions, 0 deletions
diff --git a/dom/svg/test/test_scientific.html b/dom/svg/test/test_scientific.html
new file mode 100644
index 0000000000..8bc0d67631
--- /dev/null
+++ b/dom/svg/test/test_scientific.html
@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=302971
+-->
+<head>
+ <title>Test for Bug 302971</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=302971">Mozilla Bug 302971</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe id="svg" src="scientific-helper.svg"></iframe>
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+
+ function runTests() {
+ var doc = $("svg").contentWindow.document;
+ var rect = doc.getElementById("rect");
+
+ // ordinary
+
+ rect.setAttribute("stroke-width", "5");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "5px", "Ordinary");
+
+ // valid exponential notation
+
+ rect.setAttribute("stroke-width", "4E1");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "40px", "Exponent");
+
+ rect.setAttribute("stroke-width", "6e1");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "60px", "Lower-case Exponent");
+
+ rect.setAttribute("stroke-width", "2E+1");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "20px", "Positive Exponent");
+
+ rect.setAttribute("stroke-width", "100E-1");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "10px", "Negative Exponent");
+
+ rect.setAttribute("stroke-width", "0.7E1");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "7px", "Floating Point with Exponent");
+
+ rect.setAttribute("stroke-width", "50.0E-1");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "5px", "Floating Point with Negative Exponent");
+
+ rect.setAttribute("stroke-width", "0.8E+1");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "8px", "Floating Point with Positive Exponent");
+
+ rect.setAttribute("stroke-width", "4E1px");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "40px", "Units");
+
+ // check units that begin with the letter e
+
+ var font_size = doc.defaultView.getComputedStyle(rect).getPropertyValue("font-size");
+
+ rect.setAttribute("stroke-width", "1em");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), font_size, "em Units");
+
+ // invalid exponential notation
+
+ rect.setAttribute("stroke-width", "1E1.1");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "Floating Point Exponent");
+
+ rect.setAttribute("stroke-width", "E1");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "No Mantissa");
+
+ rect.setAttribute("stroke-width", "1 e");
+ is(doc.defaultView.getComputedStyle(rect).getPropertyValue("stroke-width"), "1px", "Spaces");
+
+ SimpleTest.finish();
+ }
+
+ window.addEventListener("load", runTests);
+</script>
+</pre>
+</body>
+</html>