summaryrefslogtreecommitdiffstats
path: root/dom/svg/test/test_scientific.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/svg/test/test_scientific.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/svg/test/test_scientific.html')
-rw-r--r--dom/svg/test/test_scientific.html84
1 files changed, 84 insertions, 0 deletions
diff --git a/dom/svg/test/test_scientific.html b/dom/svg/test/test_scientific.html
new file mode 100644
index 000000000..482738514
--- /dev/null
+++ b/dom/svg/test/test_scientific.html
@@ -0,0 +1,84 @@
+<!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 type="application/javascript" 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");
+ var text = doc.getElementById("text");
+
+ // ordinary
+
+ rect.setAttribute("stroke-width", "5");
+ is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "5", "Ordinary");
+
+ // valid exponential notation
+
+ rect.setAttribute("stroke-width", "4E1");
+ is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "40", "Exponent");
+
+ rect.setAttribute("stroke-width", "6e1");
+ is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "60", "Lower-case Exponent");
+
+ rect.setAttribute("stroke-width", "2E+1");
+ is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "20", "Positive Exponent");
+
+ rect.setAttribute("stroke-width", "100E-1");
+ is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "10", "Negative Exponent");
+
+ rect.setAttribute("stroke-width", "0.7E1");
+ is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "7", "Floating Point with Exponent");
+
+ rect.setAttribute("stroke-width", "50.0E-1");
+ is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "5", "Floating Point with Negative Exponent");
+
+ rect.setAttribute("stroke-width", "0.8E+1");
+ is(doc.defaultView.getComputedStyle(rect, '').getPropertyValue("stroke-width"), "8", "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, false);
+</script>
+</pre>
+</body>
+</html>