OLD | NEW |
1 // global async_test, assert_equals | 1 // global async_test, assert_equals |
2 // | 2 // |
3 // This test generates a couple of scenarios (each a TestData) for | 3 // This test generates a couple of scenarios (each a TestData) for |
4 // sizing SVG inside an inline <object> and has a simple JavaScript | 4 // sizing SVG inside an inline <object> and has a simple JavaScript |
5 // sizing implementation that handles the generated scenarios. It | 5 // sizing implementation that handles the generated scenarios. It |
6 // generates a DOM corresponding to the scenario and compares the laid | 6 // generates a DOM corresponding to the scenario and compares the laid |
7 // out size to the calculated size. | 7 // out size to the calculated size. |
8 // | 8 // |
9 // The tests loops through different combinations of: | 9 // The tests loops through different combinations of: |
10 // | 10 // |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 doCombinationTestRecursive(values, {}); | 379 doCombinationTestRecursive(values, {}); |
380 } | 380 } |
381 | 381 |
382 var debugHint = function(id) { return "(append ?"+id+" to debug) " }; | 382 var debugHint = function(id) { return "(append ?"+id+" to debug) " }; |
383 var testSingleId; | 383 var testSingleId; |
384 if (window.location.search) { | 384 if (window.location.search) { |
385 testSingleId = window.location.search.substring(1); | 385 testSingleId = window.location.search.substring(1); |
386 debugHint = function(id) { return ""; }; | 386 debugHint = function(id) { return ""; }; |
387 } | 387 } |
388 | 388 |
389 function testSVGInObjectWithPlaceholder(placeholderWidthAttr, placeholderHeightA
ttr) { | 389 function testSVGInObjectWithPlaceholder(placeholderWidthAttr, placeholderHeightA
ttr, viewBoxAttr) { |
390 doCombinationTest( | 390 doCombinationTest( |
391 [["containerWidthStyle", [null, "400px"]], | 391 [["containerWidthStyle", [null, "400px"]], |
392 ["containerHeightStyle", [null, "400px"]], | 392 ["containerHeightStyle", [null, "400px"]], |
393 ["placeholderWidthAttr", [placeholderWidthAttr]], | 393 ["placeholderWidthAttr", [placeholderWidthAttr]], |
394 ["placeholderHeightAttr", [placeholderHeightAttr]], | 394 ["placeholderHeightAttr", [placeholderHeightAttr]], |
395 ["svgViewBoxAttr", [ null, "0 0 100 200" ]], | 395 ["svgViewBoxAttr", [ viewBoxAttr ]], |
396 ["svgWidthAttr", [ null, "200", "25%" ]], | 396 ["svgWidthAttr", [ null, "200", "25%" ]], |
397 ["svgHeightAttr", [ null, "200", "25%" ]]], | 397 ["svgHeightAttr", [ null, "200", "25%" ]]], |
398 function(config, id) { | 398 function(config, id) { |
399 if (!testSingleId || testSingleId == id) { | 399 if (!testSingleId || testSingleId == id) { |
400 var testData = new TestData(config); | 400 var testData = new TestData(config); |
401 var t = async_test(testData.name); | 401 var t = async_test(testData.name); |
402 | 402 |
403 var expectedRect = | 403 var expectedRect = |
404 testData.computeInlineReplacedSize(); | 404 testData.computeInlineReplacedSize(); |
405 var placeholder = setupPlaceholder(testData); | 405 var placeholder = setupPlaceholder(testData); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 iframe.src = "data:text/html;charset=utf-8," + encodeURIComponen
t(demo); | 452 iframe.src = "data:text/html;charset=utf-8," + encodeURIComponen
t(demo); |
453 document.body.appendChild(iframe); | 453 document.body.appendChild(iframe); |
454 | 454 |
455 document.body.insertAdjacentHTML( | 455 document.body.insertAdjacentHTML( |
456 'beforeEnd', | 456 'beforeEnd', |
457 '<p><a href="data:application/octet-stream;charset=utf-8;bas
e64,' + | 457 '<p><a href="data:application/octet-stream;charset=utf-8;bas
e64,' + |
458 btoa(demo) + '" download="svg-in-object-test-' + pad(id,
3) + '.html">Download</a></p>'); | 458 btoa(demo) + '" download="svg-in-object-test-' + pad(id,
3) + '.html">Download</a></p>'); |
459 } | 459 } |
460 }); | 460 }); |
461 } | 461 } |
OLD | NEW |