OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <title>img current pixel density basic</title> |
| 3 <script src="../../../../../../../resources/testharness.js"></script> |
| 4 <script src="../../../../../../../resources/testharnessreport.js"></script> |
| 5 <div id=log></div> |
| 6 <img src="/images/green-256x256.png" data-expect="256"> |
| 7 <img srcset="/images/green-256x256.png 1x" data-expect="256"> |
| 8 <img srcset="/images/green-256x256.png 1.6x" data-expect="160"> |
| 9 <img srcset="/images/green-256x256.png 2x" data-expect="128"> |
| 10 <img srcset="/images/green-256x256.png 10000x" data-expect="0"> |
| 11 <img srcset="/images/green-256x256.png 9e99999999999999999999999x" data-expect="
0"> |
| 12 <img srcset="/images/green-256x256.png 256w" sizes="256px" data-expect="256"> |
| 13 <img srcset="/images/green-256x256.png 512w" sizes="256px" data-expect="128"> |
| 14 <img srcset="/images/green-256x256.png 256w" sizes="512px" data-expect="512"> |
| 15 <img srcset="/images/green-256x256.png 256w" sizes="1px" data-expect="1"> |
| 16 <img srcset="/images/green-256x256.png 256w" sizes="0px" data-expect="0"> |
| 17 <script> |
| 18 setup({explicit_done:true}); |
| 19 onload = function() { |
| 20 [].forEach.call(document.images, function(img) { |
| 21 test(function() { |
| 22 var expected = parseFloat(img.dataset.expect); |
| 23 assert_equals(img.width, expected, 'width'); |
| 24 assert_equals(img.height, expected, 'height'); |
| 25 assert_equals(img.clientWidth, expected, 'clientWidth'); |
| 26 assert_equals(img.clientHeight, expected, 'clientHeight'); |
| 27 assert_equals(img.naturalWidth, 256, 'naturalWidth'); |
| 28 assert_equals(img.naturalHeight, 256, 'naturalHeight'); |
| 29 }, img.outerHTML); |
| 30 }); |
| 31 done(); |
| 32 }; |
| 33 </script> |
OLD | NEW |