OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script> |
| 4 window.targetScaleFactor = 2; |
| 5 </script> |
| 6 <script src="../../hidpi/resources/srcset-helper.js"></script> |
| 7 <script src="../../../resources/js-test.js"></script> |
| 8 <script> |
| 9 if (window.testRunner) |
| 10 testRunner.dumpAsText(); |
| 11 |
| 12 addEventListener("load", function() { |
| 13 shouldBeTrue('document.getElementById("simple").clientWidth==window.inne
rWidth'); |
| 14 shouldBeTrue('document.getElementById("simple").currentSrc=="resources/i
mage-set-2x.png"'); |
| 15 shouldBeTrue('document.getElementById("sizes_x_descriptors").clientWidth
==400'); |
| 16 shouldBeTrue('document.getElementById("sizes_x_descriptors").currentSrc=
="resources/image-set-2x.png"'); |
| 17 shouldBeTrue('document.getElementById("sizes_src").clientWidth==400'); |
| 18 shouldBeTrue('document.getElementById("sizes_src").currentSrc=="resource
s/image-set-1x.png"'); |
| 19 shouldBeTrue('document.getElementById("default_sizes").clientWidth==wind
ow.innerWidth'); |
| 20 shouldBeTrue('document.getElementById("default_sizes").currentSrc=="reso
urces/image-set-4x.png"'); |
| 21 shouldBeTrue('document.getElementById("invalid_length").clientWidth==win
dow.innerWidth'); |
| 22 shouldBeTrue('document.getElementById("invalid_length").currentSrc=="res
ources/image-set-2x.png"'); |
| 23 shouldBeTrue('document.getElementById("src_and_w").clientWidth==700'); |
| 24 shouldBeTrue('document.getElementById("src_and_w").currentSrc=="resource
s/image-set-4x.png"'); |
| 25 shouldBeTrue('document.getElementById("x_and_w").clientWidth==700'); |
| 26 shouldBeTrue('document.getElementById("x_and_w").currentSrc=="resources/
image-set-4x.png"'); |
| 27 shouldBeTrue('document.getElementById("x_and_w2").clientWidth==400'); |
| 28 shouldBeTrue('document.getElementById("x_and_w2").currentSrc=="resources
/image-set-2x.png"'); |
| 29 shouldBeTrue('document.getElementById("x_and_w3").clientWidth==400'); |
| 30 shouldBeTrue('document.getElementById("x_and_w3").currentSrc=="resources
/image-set-2x.png"'); |
| 31 shouldBeTrue('document.getElementById("half_size").clientWidth==(window.
innerWidth/2)'); |
| 32 shouldBeTrue('document.getElementById("half_size").currentSrc=="resource
s/image-set-2x.png"'); |
| 33 shouldBeTrue('document.getElementById("infitisimal_sizes").clientWidth==
(window.innerWidth/100)'); |
| 34 shouldBeTrue('document.getElementById("infitisimal_sizes").currentSrc=="
resources/image-set-2x.png"'); |
| 35 }, false); |
| 36 </script> |
| 37 </head> |
| 38 |
| 39 <body id="body"> |
| 40 <img id="simple" src="" sizes="(max-width: 300px) 400px, 800px" srcset="reso
urces/image-set-1x.png 400w, resources/image-set-2x.png 800w"> |
| 41 <!-- 'sizes' has no imapct on 'x' or 'src' resources --> |
| 42 <img id="sizes_x_descriptors" src="" sizes="50vw" srcset="resources/image-se
t-1x.png 1x, resources/image-set-2x.png 2x"> |
| 43 <img id="sizes_src" src="resources/image-set-1x.png" sizes="50vw"> |
| 44 <!-- Missing sizes or an invalid one, give a source size of 100vw --> |
| 45 <img id="default_sizes" src="" srcset="resources/image-set-1x.png 400w, reso
urces/image-set-2x.png 800w, resources/image-set-4x.png 1600w"> |
| 46 <img id="invalid_length" src="" sizes="(max-width: 300px) 400w, 800w" srcset
="resources/image-set-1x.png 400w, resources/image-set-2x.png 800w"> |
| 47 <img id="src_and_w" src="resources/image-set-1x.png" sizes="700px" srcset="r
esources/image-set-4x.png 1600w"> |
| 48 <img id="x_and_w" sizes="700px" srcset="resources/image-set-1x.png 0.5x, res
ources/image-set-4x.png 1600w"> |
| 49 <!-- The 'x' resource should be picked, and 'sizes' have no impact on its in
trisic size --> |
| 50 <img id="x_and_w2" sizes="700px" srcset="resources/image-set-2x.png 2x, reso
urces/image-set-4x.png 16000w"> |
| 51 <img id="x_and_w3" sizes="700px" srcset="resources/image-set-4x.png 16000w,
resources/image-set-2x.png 2x"> |
| 52 <!-- The intrinsic size should be identical to the 'sizes' value --> |
| 53 <img id="half_size" sizes="50vw" srcset="resources/image-set-2x.png 800w, re
sources/image-set-4x.png 16000w"> |
| 54 <img id="infitisimal_sizes" sizes="1vw" srcset="resources/image-set-2x.png 8
00w, resources/image-set-4x.png 16000w"> |
| 55 </body> |
| 56 </html> |
OLD | NEW |