2 <html xmlns=
"http://www.w3.org/1999/xhtml">
4 https://bugzilla.mozilla.org/show_bug.cgi?id=302971
7 <title>Test for Bug
302971</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
12 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=302971">Mozilla Bug
302971</a>
14 <div id=
"content" style=
"display: none"></div>
16 <iframe id=
"svg" src=
"scientific-helper.svg"></iframe>
19 <script class=
"testbody" type=
"application/javascript">
20 SimpleTest.waitForExplicitFinish();
23 var doc = $(
"svg").contentWindow.document;
24 var rect = doc.getElementById(
"rect");
28 rect.setAttribute(
"stroke-width",
"5");
29 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"5px",
"Ordinary");
31 // valid exponential notation
33 rect.setAttribute(
"stroke-width",
"4E1");
34 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"40px",
"Exponent");
36 rect.setAttribute(
"stroke-width",
"6e1");
37 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"60px",
"Lower-case Exponent");
39 rect.setAttribute(
"stroke-width",
"2E+1");
40 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"20px",
"Positive Exponent");
42 rect.setAttribute(
"stroke-width",
"100E-1");
43 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"10px",
"Negative Exponent");
45 rect.setAttribute(
"stroke-width",
"0.7E1");
46 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"7px",
"Floating Point with Exponent");
48 rect.setAttribute(
"stroke-width",
"50.0E-1");
49 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"5px",
"Floating Point with Negative Exponent");
51 rect.setAttribute(
"stroke-width",
"0.8E+1");
52 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"8px",
"Floating Point with Positive Exponent");
54 rect.setAttribute(
"stroke-width",
"4E1px");
55 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"40px",
"Units");
57 // check units that begin with the letter e
59 var font_size = doc.defaultView.getComputedStyle(rect).getPropertyValue(
"font-size");
61 rect.setAttribute(
"stroke-width",
"1em");
62 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"), font_size,
"em Units");
64 // invalid exponential notation
66 rect.setAttribute(
"stroke-width",
"1E1.1");
67 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"1px",
"Floating Point Exponent");
69 rect.setAttribute(
"stroke-width",
"E1");
70 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"1px",
"No Mantissa");
72 rect.setAttribute(
"stroke-width",
"1 e");
73 is(doc.defaultView.getComputedStyle(rect).getPropertyValue(
"stroke-width"),
"1px",
"Spaces");
78 window.addEventListener(
"load", runTests);