test_SVGLengthList-2.xhtml (1734B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <!-- 3 https://bugzilla.mozilla.org/show_bug.cgi?id=630760 4 --> 5 <head> 6 <title>Tests specific to SVGLengthList</title> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 9 </head> 10 <body> 11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=515116">Mozilla Bug 630760</a> 12 <p id="display"></p> 13 <div id="content" style="display:none;"> 14 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="100" height="100"> 15 <text id="text"> 16 <set attributeName="x" to="10 20 30 40" begin="0" dur="indefinite"/> 17 </text> 18 </svg> 19 </div> 20 <pre id="test"> 21 <script class="testbody" type="text/javascript"> 22 <![CDATA[ 23 24 SimpleTest.waitForExplicitFinish(); 25 26 function run_tests() { 27 var svg = document.getElementById("svg"); 28 svg.pauseAnimations(); 29 30 // Check that the animVal list for 'x' on <text> gives the correct number of 31 // items when examined for the FIRST time DURING animation: 32 33 var text = document.getElementById("text"); 34 var list = text.x.animVal; 35 36 is(list.numberOfItems, 4, "Checking numberOfItems"); 37 38 // Check that items at an index larger than 255 (max value for PRUint8) are 39 // returning the correct values: 40 41 var item; 42 list = text.x.baseVal; 43 for (var i = 0; i < 256; ++i) { 44 item = svg.createSVGLength(); 45 item.value = 1; 46 list.appendItem(item); 47 } 48 item = svg.createSVGLength(); 49 item.value = 2; 50 list.appendItem(item); 51 52 is(list.getItem(0).value, 1, "Check value of first item"); 53 is(list.getItem(256).value, 2, "Check value of item at index > 255"); 54 55 SimpleTest.finish(); 56 } 57 58 window.addEventListener("load", run_tests); 59 60 ]]> 61 </script> 62 </pre> 63 </body> 64 </html>