test_units_angle.html (1454B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test for serialization and equivalence of angle units</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 7 </head> 8 <body> 9 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a> 10 <p id="display"></p> 11 <div id="content" style="display: none"> 12 13 </div> 14 <pre id="test"> 15 <script type="application/javascript"> 16 17 /** Test for serialization and equivalence of angle units */ 18 19 /** 20 * We test that for each of the following: 21 * + they reserialize to exactly what is given 22 * + if a mapping is provided, they compute to the same result as the mapping 23 */ 24 var tests = { 25 "45deg": "50grad", 26 "150grad": "135deg", 27 "1rad": null 28 }; 29 30 var p = document.getElementById("display"); 31 32 for (var test in tests) { 33 p.setAttribute("style", "transform: rotate(" + test + ")"); 34 is(p.style.getPropertyValue("transform"), "rotate(" + test + ")", 35 test + " serializes to exactly itself"); 36 // We can't test any equivalence since we don't have any properties 37 // with angle values that we compute. (transform doesn't help.) 38 /* 39 var equiv = tests[test]; 40 if (equiv) { 41 var cm1 = getComputedStyle(p, "").elevation; 42 p.style.elevation = equiv; 43 var cm2 = getComputedStyle(p, "").elevation; 44 is(cm1, cm2, test + " should compute to the same as " + equiv); 45 } 46 */ 47 } 48 49 </script> 50 </pre> 51 </body> 52 </html>